Tree
This blog talks about trees in general
Last updated
This blog talks about trees in general
Last updated
Symmetric Tree - determine whether a binary tree is symmetric:
Maximum Depth of Binary Tree - find the maximum depth of a binary tree:
Binary Tree Level Order Traversal - return the level order traversal of a binary tree:
Validate Binary Search Tree - determine whether a binary tree is a valid binary search tree (BST):
Path Sum - determine if a binary tree has a root-to-leaf path such that adding up all the values along the path equals a given target sum:
Binary Tree Inorder Traversal - return the inorder traversal of a binary tree:
Construct Binary Tree from Preorder and Inorder Traversal - given the preorder and inorder traversal of a binary tree, construct the binary tree:
Binary Tree Maximum Path Sum - find the maximum path sum in a binary tree:
Binary Tree Level Order Traversal II - return the bottom-up level order traversal of a binary tree:
Flatten Binary Tree to Linked List - flatten a binary tree to a linked list in-place:
Populating Next Right Pointers in Each Node - connect each node of a binary tree to its right sibling:
Lowest Common Ancestor of a Binary Tree - find the lowest common ancestor (LCA) of two nodes in a binary tree:
Binary Tree Postorder Traversal - return the postorder traversal of a binary tree:
Sum Root to Leaf Numbers - find the sum of all root-to-leaf numbers in a binary tree:
Same Tree - determine whether two binary trees are the same:
Invert Binary Tree - invert a binary tree:
Binary Tree Zigzag Level Order Traversal - return the zigzag level order traversal of a binary tree:
Diameter of Binary Tree - find the diameter of a binary tree:
House Robber III - find the maximum amount of money you can rob without robbing adjacent houses represented by a binary tree:
Construct Binary Tree from Inorder and Postorder Traversal - given the inorder and postorder traversal of a binary tree, construct the binary tree:
Depth-First Search (DFS) - a graph traversal algorithm that traverses a tree or graph by exploring as far as possible along each branch before backtracking.
Breadth-First Search (BFS) - a graph traversal algorithm that traverses a tree or graph by visiting all the nodes at a given depth before moving on to the next depth.
Dijkstra's Algorithm - a shortest-path algorithm that finds the shortest path between a starting node and all other nodes in a weighted graph.
Prim's Algorithm - a minimum spanning tree algorithm that finds the minimum spanning tree for a connected weighted graph.
Kruskal's Algorithm - another minimum spanning tree algorithm that finds the minimum spanning tree for a connected weighted graph.
Morris Traversal - a space-efficient, in-order tree traversal algorithm that does not require the use of a stack or recursion.
Tarjan's Algorithm - a graph algorithm for finding strongly connected components in a directed graph.
A* Search Algorithm - a pathfinding algorithm that finds the shortest path between two nodes in a graph or grid by considering both the actual cost of reaching a node and the heuristic estimate of the remaining cost.
Huffman Coding Algorithm - an algorithm used for lossless data compression that creates variable-length prefix codes for characters based on their frequency of occurrence.
Interval Tree Algorithm - a tree-based data structure used for efficient searching of intervals in one-dimensional space.
Binary Tree Traversal - given a binary tree, perform a traversal of the nodes in a specific order (preorder, inorder, postorder, level order).
Lowest Common Ancestor (LCA) - given a binary tree and two nodes, find the lowest common ancestor of the two nodes.
Maximum Depth or Height of a Binary Tree - find the maximum number of levels or nodes from the root node to the furthest leaf node in a binary tree.
Diameter of a Binary Tree - find the longest path between any two nodes in a binary tree.
Check if a Binary Tree is Balanced - determine whether a binary tree is balanced or not, where a balanced tree is defined as a tree in which the heights of the two subtrees of any node differ by at most one.
Binary Search Tree (BST) Operations - perform operations such as insert, delete, search, and traverse on a binary search tree.
Construct Binary Tree from Inorder and Preorder/Postorder Traversal - given the inorder and preorder/postorder traversal of a binary tree, construct the binary tree.
Serialize and Deserialize Binary Tree - convert a binary tree to a string representation and vice versa.
Convert Binary Tree to Doubly Linked List - convert a binary tree to a doubly linked list in-place, where the nodes of the doubly linked list are ordered in the same sequence as an inorder traversal of the binary tree.
Count the number of nodes, leaves or full nodes in a binary tree - count the total number of nodes, the number of leaves, or the number of full nodes in a binary tree.
Binary Search Tree (BST) - a binary tree data structure in which the value of each node is greater than or equal to the values in its left subtree and less than or equal to the values in its right subtree.
AVL Tree - a self-balancing binary search tree in which the heights of the two child subtrees of any node differ by at most one.
Red-Black Tree - a self-balancing binary search tree in which each node has an extra bit, and that bit is often interpreted as the color (red or black) of the node.
B-Tree - a tree data structure that allows efficient insertion, deletion and search operations on sorted data.
Trie - a tree-like data structure used to store associative arrays where the keys are usually strings.
Segment Tree - a tree data structure used for storing information about intervals, or segments.
KD-Tree - a space partitioning data structure used for organizing points in a k-dimensional space.
Fenwick Tree (Binary Indexed Tree) - a data structure that efficiently updates and calculates prefix sums (cumulative sums) of a sequence of values.
Huffman Tree - a specific type of binary tree used for data compression in which the frequency of occurrence of each symbol is used to assign a variable-length code to each symbol.
Suffix Tree - a tree data structure used for efficient string searching, in particular for finding substrings within a larger string.