A binary search tree is an ordered binary tree. The left subtree contains nodes whose keys are less than the node’s key value, while the right subtree contains nodes whose keys are greater than or equal to the node’s key value. Moreover, both subtrees are also binary search trees. A binary search …
In a binary search tree, a node has two references, left child and right child. A binary search tree with parent is an variation of a binary search tree – a node has an additional reference to its parent node. Normally a binary search tree’s operations start from the root …
A circular queue is a queue in which all elements are connected to form a circular. A circular queue can be implemented with an array or a linked list. In the array implementation, the index of the rear element wraps around to the beginning of the array. In the linked …
A priority queue is a queue in which you insert an element at the back (enqueue) and remove an element from the front (dequeue). Meanwhile, a priority queue is a special queue, the element with the highest priority shall be dequeued first. You can implement priority queue using an array. …
A trie is a tree-like data structure in which every node stores a character. A trie can store multiple words. After building a trie, strings or substrings can be retrieved by traversing down a path (a branch) of the trie. Insert a word in a trie, search a word, or …
A trie is a tree-like data structure in which every node stores a character. A tire can store one or multiple words. After building a trie, strings or substrings can be retrieved by traversing down a path (a branch) of the trie. Tries are used to find substrings, autocomplete and …
A trie is a tree-like data structure in which every node stores a character. A trie can store multiple words. After building a trie, strings or substrings can be retrieved by traversing down a path (a branch) of the trie. Tries are used to find substrings, autocomplete and many other …
Hash table is a data structure that can map keys to values. A hash table uses a hash function to compute a key into an integer (hash value), which indicates the index of the buckets (aka array). From the key, the correct value can be stored and found. The time …
Max heap is a complete binary tree, in which all levels are completely filled and all the nodes in the last level are as left as possible. Max heap also meets this criteria: the parent’s key is larger than both children’s keys. The largest value is at the root. Heap is …
Min heap is a complete binary tree, in which all levels are completely filled and all the nodes in the last level are as left as possible. Min heap also meets this criteria: the parent’s key is less than both children’s keys. The smallest value is at the root. This post …