Each recursive call adds a new stack frame containing:
• Function parameters
• Local variables
• Return address
If recursion is too deep, it can lead to a Stack Overflow error.
8️⃣0️⃣ What is the Time Complexity of Common Data Structures?
Answer:
Data Structure | Search | Insert | Delete
Array | O(n) | O(n) | O(n)
Linked List | O(n) | O(1) | O(1)
Stack | O(n) | O(1) | O(1)
Queue | O(n) | O(1) | O(1)
Hash Table | O(1) | O(1) | O(1)
Binary Search Tree | O(log n) | O(log n) | O(log n)
Heap | O(n) | O(log n) | O(log n)
*Average case. Worst-case performance may be higher depending on the implementation.
🔥 Double Tap ❤️ For Part-9
Post #2761
2.19K
- ❤ 8