Teja Illaakadurga.hashnode.dev·Oct 2, 2024DFS and BFS on a Single GraphBFS and DFS Algorithm on a single Graph Take an Example of the below Graph import java.util.*; public class Main { public static class Graph { int v; int e; List<List<Integer>> arrList; public Graph(int v, int e) { this.v...DiscussDFS
Rohit Gawanderohit253.hashnode.dev·Sep 29, 2024Chapter 44: Graphs (Part 1)In this chapter, we will embark on an in-depth exploration of Graphs, one of the most versatile and widely-used data structures in computer science. Graphs play a crucial role in representing relationships between entities, making them indispensable ...DiscussDSA(Data Structure and Algorithm) In JAVAData Structures and Algorithm
Jyotiprakash Mishrablog.jyotiprakash.org·Sep 25, 2024Introduction to GraphsA graph is a collection of nodes (also called vertices) and edges that connect pairs of nodes. Graphs are an abstract data structure used to represent relationships between objects. A graph G is typically denoted as G = (V, E), where: V is the set o...Discuss·10 likes·1.1K readsgraphs
Dharansh Neemadharanshneema.hashnode.dev·Sep 25, 2024DFS and BFS in graph using Adjacency matrixTerminologies Graph : In DSA generally Graph means set of nodes which are connected to each other (not necessarily). A graph can be collection of nodes which are not connected to each other(disjoined graph). The graph is composed of Vertex and Edges...Discuss·10 likesGraph
Chetan Dattachetan77.hashnode.dev·Sep 23, 2024Height of a Binary Tree - Max DepthProblem Given the root of a binary tree, return its maximum depth. A binary tree's maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. (link) Example 1: Input: root = [3,9,20,null,null,15,7]...DiscussLeetcodeHeight of a Binary Tree
Chetan Dattachetan77.hashnode.dev·Sep 21, 2024Binary Trees | Types | BFS | DFSIntroduction Arrays and linked lists are flat structures, whereas a tree is a hierarchical structure. If a tree has only 2 children, then it is called a binary tree. Terminology Root: The head of the tree is called the root node. Leaf node: A n...DiscussLeetcodetraversals
Priya Mannurrookiecoderblogs.hashnode.dev·Jul 19, 2024Breadth First SearchBreadth first search is used in graph algorithms for traversing through graph. It can be used to sort the graph, find cycles, solve mazes and sudokus. In this algorithm we traverse the neighbours of the nodes first and mark them down. We go on like t...DiscussBFS
Abhilietcode.hashnode.dev·Jun 30, 2024Evaluate Division - BFSYou are given an array of variable pairs equations and an array of real numbers values, where equations[i] = [A<sub>i</sub>, B<sub>i</sub>] and values[i] represent the equation A<sub>i</sub> / B<sub>i</sub> = values[i]. Each A<sub>i</sub> or B<sub>i<...DiscussGraphsBFS
Abhilietcode.hashnode.dev·Jun 30, 2024Word Ladder II - BFSA transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words beginWord -> s<sub>1</sub> -> s<sub>2</sub> -> ... -> s<sub>k</sub> such that: Every adjacent pair of words differs by a single letter. ...DiscussGraphsBFS
Abhilietcode.hashnode.dev·Jun 30, 2024Word Ladder - BFSExample 1: Input: beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log","cog"] Output: 5 Explanation: One shortest transformation sequence is "hit" -> "hot" -> "dot" -> "dog" -> cog", which is 5 words long. Example 2: Input: ...DiscussGraphsgraph database