This challenging quiz evaluates your understanding of foundational data structures, algorithmic complexity notations, and the nuances of time and space complexity analysis. Tackle scenario-based questions to demonstrate mastery of Big O, Big Θ, and Big Ω.
Which of the following statements correctly distinguishes between Big O, Big Θ, and Big Ω notations regarding the time complexity of an algorithm?
Given the code fragment: for(i = 0; i u003C n; i++) { for(j = 0; j u003C n; j++) { /* constant time */ } }, what is the Big O time complexity in terms of n?
For a recursive function that calls itself once per invocation until n equals 0 (e.g., computing factorial recursively), what is the space complexity with respect to n, excluding input size?
When analyzing a dynamic array that doubles its capacity upon reaching its limit, what is the amortized time complexity of inserting n elements?
What is the asymptotic lower bound for the number of comparisons needed to sort n distinct numbers using any comparison-based sorting algorithm?
Given a linear search on an unsorted array of n elements, what is the worst-case time complexity?
Assuming a good hash function and a hashtable of size proportional to n, what is the average-case time complexity for search operations?
Which of the following notations gives the tightest bound for the time complexity of binary search on a sorted array of n elements?
What is the space complexity of representing a sparse graph with n vertices and e edges using an adjacency matrix?
Given an algorithm with time complexity 3n^2 + 4n + 5, what is its Big O classification?