galgotia contest 9

Last Updated :
Discuss
Comments

Question 1

How is binary search typically employed?

  •  Sorting an array.

  • Searching a sorted array

  • . Searching an unsorted array

  • Sorting a linked list

Question 2

During each iteration of binary search, what does the algorithm compare the target value to?

  • Middle element of the array

  • First element of the array

  • Last element of the array

  • Random element of the array

Question 3

What is the worst-case time complexity of binary search?

  •  O(1)

  • O(log n)

  • O(n)

  • O(n^2)

Question 4

In each step of binary search, the search space is reduced by:

  •  One-third

  • One-fourth

  •  Half

  •  Two-thirds

Question 5

What is the space complexity of the binary search algorithm?

  •  O(1)

  •  O(log n)

  •  O(n)

  • O(n^2)

Question 6

In a scenario where the array is sorted in descending order, what modification is required for binary search to still work correctly?

  •  No modification is needed; binary search works the same way

  •  The array needs to be reversed before applying binary search

  •  Binary search cannot be used on a descending order array

  • The comparison in each step needs to be reversed

Question 7

Given an input arr = {2,5,7,99,899}; key = 899; What is the level of recursion?

  • 5

  • 2

  • 3

  • 4

Question 8

What is the worst case complexity of binary search using recursion?

  •  O(nlogn)

  •  O(logn)

  • O(n)

  • O(n^2)

Question 9

Given an array arr = {5,6,77,88,99} and key = 88; How many iterations are done until the element is found?

  • 1

  • 3

  • 4

  • 2

Question 10

What is the worst case time complexity of insertion sort where position of the data to be inserted is calculated using binary search?

  •  N

  • N*log(N)

  • N^2

  • N*log(N)^2

Tags:

There are 10 questions to complete.

Take a part in the ongoing discussion