πŸ“Š Data Structure and Algorithms (DSA)
Q. Which of the following is not the required condition for binary search algorithm
  • (A) there must be mechanism to delete and/ or insert elements in list
  • (B) the list must be sorted
  • (C) there should be the direct access to the middle element in any sublist
  • (D) none of the above
πŸ’¬ Discuss
βœ… Correct Answer: (A) there must be mechanism to delete and/ or insert elements in list
πŸ“Š Data Structure and Algorithms (DSA)
Q. Which of the following is not a limitation of binary search algorithm ?
  • (A) binary search algorithm is not efficient when the data elements are more than 1000.
  • (B) must use a sorted array
  • (C) requirement of sorted array is expen- sive when a lot of insertion and dele- tions are needed
  • (D) there must be a mechanism to access middle element directly
πŸ’¬ Discuss
βœ… Correct Answer: (A) binary search algorithm is not efficient when the data elements are more than 1000.
πŸ“Š Data Structure and Algorithms (DSA)
Q. The following sorting algorithm is of divide- and-conquer type
  • (A) Bubble sort
  • (B) Insertion sort
  • (C) Quick sort
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (C) Quick sort

Explanation: Quick sort is a divide-and-conquer sorting algorithm that works by partitioning a list of items into two smaller lists and then sorting each of these lists recursively. It is an efficient and widely used algorithm, with an average case time complexity of O(n log n).

Bubble sort and insertion sort are both comparison-based sorting algorithms, but they do not use the divide-and-conquer approach. Bubble sort works by repeatedly swapping adjacent elements that are out of order, while insertion sort works by iteratively inserting each element into its correct position in the sorted list. Both of these algorithms have a time complexity of O(n^2) in the worst case.

πŸ“Š Data Structure and Algorithms (DSA)
Q. The elements of an array are stored suc- cessively in memory cells because
  • (A) by this way computer can keep track only the address of the first element and the addresses of other elements can be calculated
  • (B) the architecture of computer memory does not allow arrays to store other than serially
  • (C) A and B both false
  • (D) A and B both true
πŸ’¬ Discuss
βœ… Correct Answer: (A) by this way computer can keep track only the address of the first element and the addresses of other elements can be calculated

Jump to