Answers for all 20 practice questions
(C Edition & Python edition )
Answers for 20 Practice Questions (Plain Text)
-
O(1)
-
O(n)
-
O(n²)
-
O(log n)
-
Time: O(n log n), Space: O(n)
-
Average: O(n log n), Worst: O(n²)
-
O(1)
-
O(n)
-
O(n)
-
O(n)
-
Time: O(n), Space: O(n) (due to recursion stack)
-
O(V + E)
-
O(1) (if pointer to the node is given)
-
O(1)
-
O(n)
-
O(1) amortized
-
Nested loops: O(n²), Using hash table: O(n)
-
O(n)
-
O((V + E) log V)
-
Adjacency matrix: O(V²), Adjacency list: O(V + E)
.png)
Comments
Post a Comment