[go: up one dir, main page]

0% found this document useful (0 votes)
2 views1 page

Data Structures Comparison Clear

Uploaded by

baludoantonio
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Data Structures Comparison Clear

Uploaded by

baludoantonio
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Data Structure Comparison (Expanded & Clear)

Data Structure How It Works Advantages Disadvantages Applications Big-O (Avg Case)
Array Fixed-size collection in contiguous memory
Fast access O(1) Insertion/Deletion costly O(n) Lookup tables, matrices, static data Access O(1), Search O(n)

Linked List Nodes linked with pointers Dynamic size, fast insert/delete Extra memory, slow access O(n) Undo/redo, hash chaining Access O(n), Insert/Delete O(1)

Stack LIFO (Last In, First Out) Simple, fast push/pop Limited access Expression eval, backtracking, recursion Push/Pop O(1)

Queue FIFO (First In, First Out) Efficient scheduling Limited random access OS scheduling, buffering, BFS Enqueue/Dequeue O(1)

Deque Double-ended queue Insert/delete at both ends More complex Palindrome checking, job scheduling O(1)

Circular Queue Queue in circular array Efficient memory use Harder implementation Memory buffers O(1)

Hash Table Keys mapped by hash function Very fast average search/insert Collisions, poor worst-case Databases, caches, dictionaries Avg O(1), Worst O(n)

Binary Tree Each node has ≤ 2 children Simple hierarchy Skewed = poor performance Parsing, hierarchical storage Search O(n)

Binary Search Tree (BST) Left < Root < Right Faster search if balanced Can degrade to linked list Searching, sorting Search O(log n)

AVL Tree Self-balancing BST Always balanced, fast ops More rotations needed Databases, search-intensive apps Search/Insert/Delete O(log n)

Red-Black Tree BST with color-balance rules Fewer rotations, good balance Slightly slower than AVL Linux kernel, Java Collections O(log n)

B-Tree Multi-way search tree, many children Efficient disk storage More complex File systems, DB indexes Search/Insert/Delete O(log n)

B+ Tree B-Tree with linked leaves Better range queries More memory Databases, large indexes O(log n)

Heap (Min/Max) Complete binary tree with heap property Fast min/max retrieval No fast search Priority queues, heapsort Insert/Delete O(log n)

Trie Tree storing strings by prefix Fast prefix search High memory usage Autocomplete, IP routing Search O(L) (L = word length)

Graph Vertices + edges Models complex relations Memory-heavy for dense graphs Networks, routing, AI BFS/DFS O(V+E)

Skip List Layered linked list with random jumps Fast search O(log n) Needs randomization In-memory DBs, Redis Search/Insert O(log n)

Disjoint Set (Union-Find) Tracks connected components Very fast union/find Limited use cases Kruskal’s MST, clustering O(α(n)) ≈ O(1)

Segment Tree Binary tree for ranges Fast range queries Complex, high memory Range sum/min/max Query/Update O(log n)

Fenwick Tree (BIT) Compact prefix sum structure Less memory than Segment Tree Only for cumulative queries Competitive programming Update/Query O(log n)

Bloom Filter Probabilistic membership test Very memory-efficient False positives possible Spam filtering, cache lookups Insert/Search O(k)

You might also like