|
| 1 | +## Array: |
| 2 | +Access: O(1) |
| 3 | +Search: O(n) |
| 4 | +Insertion: O(n) (worst-case) |
| 5 | +Deletion: O(n) (worst-case) |
| 6 | + |
| 7 | +## Linked List: |
| 8 | +Access: O(n) |
| 9 | +Search: O(n) |
| 10 | +Insertion: O(1) (head/tail insertion) |
| 11 | +Deletion: O(1) (head/tail deletion) |
| 12 | + |
| 13 | +## Stack: |
| 14 | +Access: O(n) |
| 15 | +Search: O(n) |
| 16 | +Push: O(1) |
| 17 | +Pop: O(1) |
| 18 | + |
| 19 | +## Queue: |
| 20 | +Access: O(n) |
| 21 | +Search: O(n) |
| 22 | +Enqueue: O(1) |
| 23 | +Dequeue: O(1) |
| 24 | + |
| 25 | +## Tree: |
| 26 | +Access: O(n) (worst-case), O(log n) (balanced) |
| 27 | +Search: O(n) (worst-case), O(log n) (balanced) |
| 28 | +Insertion: O(n) (worst-case), O(log n) (balanced) |
| 29 | +Deletion: O(n) (worst-case), O(log n) (balanced) |
| 30 | + |
| 31 | +## Graph: |
| 32 | +Access: O(|V| + |E|) |
| 33 | +Search: O(|V| + |E|) |
| 34 | +Insertion: O(1) |
| 35 | +Deletion: O(1) |
| 36 | + |
| 37 | +## Hash Table / Hash Map / Hash Set: |
| 38 | +Access: O(1) (average), O(n) (worst-case) |
| 39 | +Search: O(1) (average), O(n) (worst-case) |
| 40 | +Insertion: O(1) (average), O(n) (worst-case) |
| 41 | +Deletion: O(1) (average), O(n) (worst-case) |
| 42 | + |
| 43 | +## Set: |
| 44 | +Access: N/A (sets do not support indexed access) |
| 45 | +Search: O(n) (worst-case) |
| 46 | +Insertion: O(1) (average), O(n) (worst-case) |
| 47 | +Deletion: O(1) (average), O(n) (worst-case) |
| 48 | + |
| 49 | +## Bit Set: |
| 50 | +Access: O(1) |
| 51 | +Search: O(n) (worst-case) |
| 52 | +Insertion: O(1) |
| 53 | +Deletion: O(1) |
| 54 | + |
| 55 | + |
| 56 | +Primitive Data Structures: These are the basic building blocks of data structures and are supported by most programming languages natively. Primitive data structures include: |
| 57 | + |
| 58 | +a. Integer |
| 59 | +b. Float |
| 60 | +c. Double |
| 61 | +d. Character |
| 62 | +e. Boolean |
| 63 | + |
| 64 | +Non-Primitive Data Structures: These are more complex and are typically built using primitive data structures. Non-primitive data structures can be further classified into several categories: |
| 65 | + |
| 66 | +a. Linear Data Structures: Elements are arranged sequentially, and each element is connected to its previous and next elements. Examples include: |
| 67 | + |
| 68 | +Arrays |
| 69 | +Linked Lists |
| 70 | +Stacks |
| 71 | +Queues |
| 72 | +b. Non-Linear Data Structures: Elements are connected in a hierarchical manner, and there is no specific sequence to their arrangement. Examples include: |
| 73 | + |
| 74 | +Trees |
| 75 | +Graphs |
| 76 | +c. Hash-based Data Structures: These use a hash function to map keys to their respective values, allowing for efficient access and manipulation. Examples include: |
| 77 | + |
| 78 | +Hash Tables |
| 79 | +Hash Maps |
| 80 | +Hash Sets |
| 81 | +d. Set-based Data Structures: These store a collection of distinct elements without any specific order. Examples include: |
| 82 | + |
| 83 | +Sets |
| 84 | +Bit Sets |
| 85 | +There are also specialized data structures designed for specific use cases, such as Trie, Heap, Bloom Filter, and Disjoint Set. The choice of data structure depends on the requirements of the problem you are solving, the operations you need to perform, and the efficiency and complexity constraints. |
0 commit comments