Tries
Tries
Tries
Tries
● Definition: A tree-like data structure that stores a dynamic set of strings, where each
node represents a character of a string.
● Properties:
○ Efficient Searching: Useful for fast retrieval of words.
○ Commonly used in search engines: To enhance word search speed.
● Use Cases: Autocomplete features, spell checking, and IP routing.
● Search Techniques:
○ Depth-First Search (DFS): Explores as far as possible along each branch
before backtracking.
○ Breadth-First Search (BFS): Explores all the neighbors at the present depth
prior to moving on to nodes at the next depth level.
● Use Cases: Network analysis, social network optimization, and pathfinding
algorithms.
4. Queues
● Definition: A collection of elements that follows the First In, First Out (FIFO)
principle.
● Types:
○ Simple Queue: Standard FIFO operation.
○ Circular Queue: Connects the end of the queue back to the front.
○ Priority Queue: Elements are served based on priority.
● Use Cases: Task scheduling, handling requests in servers.
5. Trees
● Definition: A hierarchical data structure consisting of nodes, with a root node and
child nodes.
● Types:
○ Binary Tree: Each node has at most two children.
○ Binary Search Tree (BST): Left child < Parent < Right child.
○ Balanced Trees (e.g., AVL, Red-Black Tree): Maintain height balance for
efficient operations.
1. Arrays
2. Linked Lists
● Definition: A linear data structure where elements are stored in nodes, each pointing
to the next.
● Types:
○ Singly Linked List: Each node points to the next node.
○ Doubly Linked List: Each node points to both the next and the previous
node.
● Use Cases: Dynamic memory allocation, insertion and deletion of elements.
3. Stacks
● Definition: A collection of elements that follows the Last In, First Out (LIFO)
principle.
● Operations:
○ Push: Add an element to the top.
○ Pop: Remove the top element.
● Use Cases: Undo functionality in applications, parsing expressions.