Des Alg
Des Alg
True/False Questions
1. Algorithms must always have a finite number of steps. (True)
2. Theoretical analysis of an algorithm depends on the type of hardware used. (False)
3. The best-case complexity provides an upper bound on execution time. (False)
4. The running time of an algorithm grows as the input size increases. (True)
5. The space complexity of an algorithm refers to the amount of memory it uses. (True)
6. A correct algorithm must always halt with the expected output. (True)
7. Sorting a list using Bubble Sort is an example of Divide and Conquer. (False)
8. Big O notation describes the worst-case performance of an algorithm. (True)
9. A Brute Force algorithm is always the best solution. (False)
10. Recursion is a technique used in Divide and Conquer algorithms. (True)
11. A computer program and an algorithm are the same thing. (False)
12. The best algorithms always use the least amount of memory. (False)
13. Plagiarism in coding includes copying another student’s work without permission. (True)
14. Hashing is a technique used to search for data efficiently. (True)
15. A loop that runs indefinitely is an example of a correct algorithm. (False)
16. Algorithm correctness is more important than efficiency. (True)
17. The efficiency of an algorithm is measured only in time complexity. (False)
18. The number of steps in a nested loop is determined by multiplying loop iterations. (True)
19. Algorithm complexity can be improved using optimization techniques. (True)
20. Every problem can be solved using an algorithm. (False)
True/False Questions
1. Big-O notation provides an exact running time for an algorithm. (False)
2. O(n) complexity means execution time increases linearly with input size. (True)
3. A quadratic function grows slower than a cubic function. (True)
4. The notation O(n log n) means the function grows exponentially. (False)
5. An algorithm with O(1) complexity always runs in constant time. (True)
6. The growth rate of a function matters more than constant factors in asymptotic analysis.
(True)
7. Binary search has a worst-case complexity of O(n). (False)
8. O(n³) represents a polynomial-time algorithm. (True)
9. Exponential algorithms are more efficient than logarithmic ones. (False)
10. Logarithmic time complexity is faster than linear time complexity. (True)
11. The best case and worst case for an algorithm are always the same. (False)
12. Asymptotic analysis ignores constant factors when comparing algorithms. (True)
13. Merge Sort has a better worst-case complexity than Bubble Sort. (True)
14. An algorithm that runs in O(n²) is faster than one in O(n log n). (False)
15. Linear search has a complexity of O(1). (False)
16. Asymptotic notation is useful for predicting algorithm performance for large inputs.
(True)
17. A function in O(n³) grows faster than a function in O(n²). (True)
18. O(n!) represents the worst possible complexity class. (True)
19. If f(n) = O(g(n)), then g(n) is always larger than f(n). (False)
20. The asymptotic complexity of an algorithm remains the same regardless of programming
language. (True)
True/False Questions
1. Bubble Sort always takes O(n²) time. (False, best case O(n))
2. Merge Sort is an in-place sorting algorithm. (False, requires extra space)
3. Selection Sort performs the same number of comparisons regardless of the input order.
(True)
4. Insertion Sort is efficient for small input sizes. (True)
5. Quick Sort has a worst-case time complexity of O(n log n). (False, worst-case O(n²))
6. Heap Sort is a comparison-based sorting algorithm. (True)
7. Counting Sort is a comparison-based sorting algorithm. (False, uses counting
technique)
8. Merge Sort always runs in O(n log n) time. (True)
9. Bubble Sort is considered one of the fastest sorting algorithms. (False)
10. Quick Sort works by repeatedly merging sorted subarrays. (False, it partitions the
array)
11. Merge Sort is a stable sorting algorithm. (True)
12. Heap Sort is more efficient than Quick Sort in the worst case. (True)
13. The median-of-three technique improves Quick Sort's performance. (True)
14. Counting Sort is best for sorting large datasets with small integer values. (True)
15. Heap Sort is not based on recursion. (True)
16. Merge Sort is preferred for linked lists over arrays. (True)
17. Bubble Sort and Selection Sort have the same worst-case complexity. (True, both
O(n²))
18. Quick Sort is an in-place sorting algorithm. (True)
19. The best pivot selection in Quick Sort is always the first element. (False, median-of-
three is better)
20. Heap Sort maintains a complete binary tree. (True)