Chetan Dattachetan77.hashnode.dev·Oct 27, 2024Diameter of Binary TreeProblem Given the root of a binary tree, return the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path between any two nodes in a tree. This path may or may not pass through the root. The length of a p...Leetcodediameter-of-binary-tree
Chetan Dattachetan77.hashnode.dev·Oct 26, 2024Balanced Binary TreeProblem statement Given a binary tree, determine if it is height-balanced.(link) Example 1: Input: root = [3,9,20,null,null,15,7] Output: true Example 2: Input: root = [1,2,2,3,3,null,null,4,4] Output: false Example 3: Input: root = [] Output: tr...Leetcodebalanced-binary-tree
Teja Illaakadurga.hashnode.dev·Oct 2, 2024Topological Sort AlgorithmTopological sort algorithm using DFS 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 = v; this.e = e; arrList...Topological Sort
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...DFS
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 ...DSA(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...10 likes·1.6K 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...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]...LeetcodeHeight 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...Leetcodetraversals
Chetan Dattachetan77.hashnode.dev·Sep 6, 2024Word SearchProblem Given an m x n grid of characters board and a string word, return true if word exists in the grid. The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The s...Leetcodeword-search