Difficulty Level: Rookie
Unlike Array and Linked List, which are linear data structures, tree is hierarchical (or non-linear) data structure.
- One reason to use trees might be because you want to store information that naturally forms a hierarchy. For example, the file system on a computer:
/ <-- root / \ ... home / \ ugrad course / / | \ ... cs101 cs112 cs113
- If we organize keys in form of a tree (with some ordering e.g., BST), we can search for a given key in moderate time (quicker than Linked List and slower than arrays). Self-balancing search trees like AVL and Red-Black trees guarantee an upper bound of O(Logn) for search.
- We can insert/delete keys in moderate time (quicker than Arrays and slower than Unordered Linked Lists). Self-balancing search trees like AVL and Red-Black trees guarantee an upper bound of O(Logn) for insertion/deletion.
- Like Linked Lists and unlike Arrays, Pointer implementation of trees don’t have an upper limit on number of nodes as nodes are linked using pointers.
Other Applications :
- Heap is a tree data structure which is implemented using arrays and used to implement priority queues.
- B-Tree and B+ Tree : They are used to implement indexing in databases.
- Syntax Tree: Used in Compilers.
- K-D Tree: A space partitioning tree used to organize points in K dimensional space.
- Trie : Used to implement dictionaries with prefix lookup.
- Suffix Tree : For quick pattern searching in a fixed text.
As per Wikipedia, following are the common uses of tree.
1. Manipulate hierarchical data.
2. Make information easy to search (see tree traversal).
3. Manipulate sorted lists of data.
4. As a workflow for compositing digital images for visual effects.
5. Router algorithms
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Applications of Graph Data Structure
- Applications of Heap Data Structure
- Applications of Queue Data Structure
- Applications of linked list data structure
- Tango Tree Data Structure
- Static Data Structure vs Dynamic Data Structure
- Applications of Minimum Spanning Tree Problem
- Overview of Data Structures | Set 3 (Graph, Trie, Segment Tree and Suffix Tree)
- Data Structure alignment
- A data structure for n elements and O(1) operations
- Advantages of Trie Data Structure
- Design a data structure for LRU Cache
- Data Structure for Dictionary and Spell Checker?
- Data Structure for a single resource reservations
- Stack Data Structure (Introduction and Program)