LogIn
I don't have account.
Question 1
Which of the following sorting algorithms works best on a nearly sorted array?
1
Bubble Sort
2
Insertion Sort
3
Quick Sort
4
Selection Sort
Question 2
What is the time complexity of merging two sorted arrays of sizes m and n?
1
O(m * n)
2
O(1)
3
O(log(m + n))
4
O(m + n)
Question 3
What is the space complexity of the merge sort algorithm for sorting an array?
1
O(n)
2
O(log n)
3
O(n log n)
4
O(1)
Question 4
In which case does the time complexity of Quick Sort become O(n²)?
1
When the pivot is chosen randomly
2
When the array is already sorted and the first or last element is chosen as the pivot
3
When the pivot is always the median
4
When the array contains duplicate values
Question 5
Which sorting algorithm works best for small datasets and is easy to implement?
1
Insertion Sort
2
Merge Sort
3
Bubble Sort
4
Quick Sort
Question 6
Which of the following sorting algorithms can be used to sort a random linked list with minimum time complexity?
1
Heap Sort
2
Quick Sort
3
Merge Sort
4
Insertion Sort
Question 7
What is the time complexity of finding an element in a sorted array using binary search?
1
O(n)
2
O(1)
3
O( n log n)
4
O(log n)
Question 8
What is the purpose of Array.Sort(arr)?
1
Converts to string
2
Sorts the array in ascending order
3
Initializes array
4
Deletes array