0% found this document useful (0 votes)
0 views

Section_6_Algorithm_Complexity_Questions

The document consists of a series of questions related to algorithm complexity, covering topics such as time complexity of binary search, worst-case scenarios for quicksort, and complexities of various sorting algorithms. It includes multiple-choice questions that assess knowledge of Big-O notation and its implications on algorithm performance. The questions also address space complexity and the characteristics of different algorithms.

Uploaded by

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

Section_6_Algorithm_Complexity_Questions

The document consists of a series of questions related to algorithm complexity, covering topics such as time complexity of binary search, worst-case scenarios for quicksort, and complexities of various sorting algorithms. It includes multiple-choice questions that assess knowledge of Big-O notation and its implications on algorithm performance. The questions also address space complexity and the characteristics of different algorithms.

Uploaded by

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

Section 6: Algorithm Complexity (second instance)

Q1. What is the time complexity of binary search in a sorted array?


• A) O(n)
• B) O(log n)
• C) O(n^2)
• D) O(1)

Q2. What is the worst-case time complexity of quicksort?


• A) O(n log n)
• B) O(n^2)
• C) O(n)
• D) O(log n)

Q3. In Big-O notation, what is the complexity of inserting an element into a balanced binary
search tree?
• A) O(log n)
• B) O(n)
• C) O(1)
• D) O(n^2)

Q4. Which of the following algorithms has a linear time complexity, O(n)?
• A) Binary search
• B) Linear search
• C) Merge sort
• D) Exponential search

Q5. What is the best-case time complexity of insertion sort?


• A) O(n^2)
• B) O(n log n)
• C) O(n)
• D) O(log n)

Q6. Which of the following statements about algorithm complexity is true?


• A) Complexity is not affected by input size
• B) Complexity measures only execution speed
• C) Complexity helps in estimating resource usage based on input size
• D) Complexity does not vary with algorithm design
Q7. What is the space complexity of an iterative solution that requires no extra memory for
processing?
• A) O(n)
• B) O(1)
• C) O(log n)
• D) O(n^2)

Q8. Which of the following complexities is the best for an algorithm?


• A) O(log n)
• B) O(n)
• C) O(n log n)
• D) O(n^2)

Q9. What does Big O notation primarily describe?


• A) The exact number of operations an algorithm performs
• B) The growth rate of an algorithm’s time or space requirements
• C) The memory usage only
• D) The speed of the algorithm in a specific environment

Q10. Which sorting algorithm has the worst-case complexity of O(n^2)?


• A) Merge sort
• B) Heap sort
• C) Bubble sort
• D) Quick sort

You might also like