InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 201. |
What is the average case time complexity of cycle sort?(a) O(n^2)(b) O(n log n)(c) O(log n)(d) O(n)I got this question at a job interview.I would like to ask this question from Sorting topic in division Sorting of Data Structures & Algorithms II |
|
Answer» The correct option is (a) O(n^2) |
|
| 202. |
What is the best case time complexity of cycle sort?(a) O(n^2)(b) O(n)(c) O(n log n)(d) O(1)I got this question in an internship interview.My question comes from Sorting topic in portion Sorting of Data Structures & Algorithms II |
|
Answer» Right answer is (a) O(n^2) |
|
| 203. |
What is the auxiliary space requirement of cycle sort?(a) O(n)(b) O(1)(c) O(log n)(d) O(n log n)This question was posed to me in examination.This intriguing question comes from Sorting in portion Sorting of Data Structures & Algorithms II |
|
Answer» RIGHT option is (b) O(1) Easy explanation - CYCLE SORT REQUIRES an auxiliary space of O(1). So this makes it an in-place sorting algorithm. |
|
| 204. |
What is the worst case time complexity of cycle sort?(a) O(n)(b) O(log n)(c) O(n log n)(d) O(n^2)This question was posed to me in my homework.Question is from Sorting topic in chapter Sorting of Data Structures & Algorithms II |
|
Answer» Correct ANSWER is (d) O(n^2) |
|
| 205. |
Which of the following is an example of an unstable sorting algorithm?(a) cycle sort(b) insertion sort(c) bubble sort(d) merge sortThis question was addressed to me in quiz.The origin of the question is Sorting in portion Sorting of Data Structures & Algorithms II |
|
Answer» CORRECT choice is (a) cycle sort Easiest explanation - Out of the given options only cycle sort is an UNSTABLE sorting algorithm. This implies that the RELATIVE position of equal valued ELEMENTS in the input and sorted array does not remain the same when we USE cycle sort. |
|
| 206. |
Which of the following sorting algorithms can be considered as improvement to the binary tree sort?(a) Heap sort(b) Quick sort(c) Selection sort(d) Insertion sortThis question was addressed to me by my college professor while I was bunking the class.The origin of the question is Sorting topic in chapter Sorting of Data Structures & Algorithms II |
|
Answer» The correct answer is (a) Heap SORT |
|
| 207. |
Which of the following is false?(a) Binary tree sort and quick sort have same running time(b) Binary tree sort used BST as work area(c) As the number of elements to sort gets larger, binary tree sort gets more and more efficient(d) Both quick sort and binary tree are in place sorting algorithmsThis question was addressed to me in an online quiz.The above asked question is from Sorting in portion Sorting of Data Structures & Algorithms II |
|
Answer» Right answer is (d) Both quick sort and BINARY tree are in place SORTING algorithms |
|
| 208. |
Binary tree sort is an in-place sorting algorithm.(a) True(b) FalseThis question was addressed to me in an online interview.This interesting question is from Sorting topic in portion Sorting of Data Structures & Algorithms II |
|
Answer» The correct option is (b) False |
|
| 209. |
What is the best case time complexity of the binary tree sort?(a) O(n)(b) O(nlogn)(c) O(n^2)(d) O(logn)The question was posed to me in final exam.The query is from Sorting topic in chapter Sorting of Data Structures & Algorithms II |
|
Answer» CORRECT OPTION is (b) O(nlogn) Easy explanation - The best case OCCURS when the BST is BALANCED. So, when tree is balanced we require O(nlogn) time to build the tree and O(N) time to traverse the tree. So, the best case time complexity of the binary tree sort is O(nlogn). |
|
| 210. |
What is the worst case time complexity of the binary tree sort?(a) O(n)(b) O(nlogn)(c) O(n^2)(d) O(logn)I got this question during a job interview.Question is taken from Sorting in section Sorting of Data Structures & Algorithms II |
|
Answer» CORRECT answer is (c) O(n^2) EXPLANATION: For the binary tree sort the worst case when the BST constructed is unbalanced. BST gets unbalanced when the ELEMENTS are already sorted. So, in the worst case, O(n^2) time is required to built the BST and O(n) time to traverse the tree. THEREFORE, the worst case time complexity is O(n^2) + O(n) = O(n^2). |
|
| 211. |
In binary tree sort, we first construct the BST and then we perform _______ traversal to get the sorted order.(a) inorder(b) postorder(c) preorder(d) level orderThis question was addressed to me by my college director while I was bunking the class.My query is from Sorting topic in portion Sorting of Data Structures & Algorithms II |
|
Answer» The CORRECT OPTION is (a) inorder |
|
| 212. |
Consider the original array 17 8 12 4 26.How many comparisons are needed to construct the BST on the original array?(a) 5(b) 4(c) 7(d) 10This question was addressed to me at a job interview.The above asked question is from Sorting in chapter Sorting of Data Structures & Algorithms II |
|
Answer» The correct answer is (d) 10 |
|
| 213. |
Which of the following sorting algorithm uses the method of insertion?(a) cube sort(b) bubble sort(c) quick sort(d) selection sortI had been asked this question in an online quiz.My doubt stems from Sorting topic in portion Sorting of Data Structures & Algorithms II |
|
Answer» RIGHT choice is (a) cube sort For explanation: Cube sort is the only algorithm from the GIVEN ones that uses the method of INSERTION. Other than this, the insertion sort also uses the method of insertion for SORTING. |
|
| 214. |
Cube sort is a comparison based sort.(a) true(b) falseThis question was addressed to me in a national level competition.The doubt is from Sorting topic in section Sorting of Data Structures & Algorithms II |
|
Answer» The correct ANSWER is (a) true |
|
| 215. |
Which of the following is a disadvantage of cube sort?(a) high memory overhead for small data(b) high memory overhead for any data(c) balancing is slow(d) Iteration is slowI have been asked this question in an international level competition.My question comes from Sorting topic in division Sorting of Data Structures & Algorithms II |
|
Answer» The correct answer is (a) HIGH memory overhead for small DATA |
|
| 216. |
Cube sort is an in place sorting algorithm.(a) true(b) falseThis question was posed to me in exam.This interesting question is from Sorting topic in chapter Sorting of Data Structures & Algorithms II |
|
Answer» The correct answer is (b) false |
|
| 217. |
Which of the following algorithm is stable?(a) heap sort(b) cube sort(c) quick sort(d) bogosortI have been asked this question during an interview.The query is from Sorting in section Sorting of Data Structures & Algorithms II |
|
Answer» The CORRECT ANSWER is (d) bogosort |
|
| 218. |
What is the average case time complexity of cube sort?(a) O(n^2)(b) O(n log n)(c) O(log n)(d) O(n)The question was asked in a national level competition.This question is from Sorting topic in division Sorting of Data Structures & Algorithms II |
|
Answer» Right option is (b) O(N log n) |
|
| 219. |
What is the best case time complexity of cube sort?(a) O(n^2)(b) O(n)(c) O(n log n)(d) O(1)I have been asked this question in examination.My doubt is from Sorting in chapter Sorting of Data Structures & Algorithms II |
|
Answer» Right option is (b) O(n) |
|
| 220. |
What is the auxiliary space requirement of cube sort?(a) O(n)(b) O(1)(c) O(log n)(d) O(n log n)I have been asked this question in quiz.My question is taken from Sorting topic in chapter Sorting of Data Structures & Algorithms II |
|
Answer» RIGHT choice is (a) O(n) The best I can EXPLAIN: CUBE sort REQUIRES an AUXILIARY space of O(n). This is the worst case of auxiliary space complexity. |
|
| 221. |
What is the worst case time complexity of cube sort?(a) O(n)(b) O(log n)(c) O(n log n)(d) O(n2)This question was addressed to me during an online exam.The doubt is from Sorting in chapter Sorting of Data Structures & Algorithms II |
|
Answer» The correct option is (c) O(n LOG n) |
|
| 222. |
Which of the following is an example of parallel sorting technique?(a) bogo sort(b) sleep sort(c) cube sort(d) merge sortI have been asked this question in exam.My doubt is from Sorting topic in section Sorting of Data Structures & Algorithms II |
|
Answer» Correct answer is (c) cube sort |
|
| 223. |
What is the usual size of a run in tim sort?(a) 32(b) less than 32(c) 32-64 depending on size of the array(d) 64I got this question in an online quiz.This question is from Sorting topic in portion Sorting of Data Structures & Algorithms II |
|
Answer» Right OPTION is (c) 32-64 DEPENDING on size of the array |
|
| 224. |
In which case will tim sort will work as an insertion sort?(a) when no. of elements are less than 64(b) when no. of elements are greater than 64(c) when no. of elements are less than size of run(d) when no. of elements are less than 32I have been asked this question in semester exam.My question comes from Sorting topic in section Sorting of Data Structures & Algorithms II |
|
Answer» Correct answer is (c) when no. of elements are less than size of run |
|
| 225. |
Why is insertion sort preferred over other sorting algorithms (like selection sort, bubble sort etc.) for Tim sort implementation?(a) Because insertion sort is faster and adaptive(b) Because insertion sort requires less space(c) Because insertion sort is easy to implement(d) Because insertion sort is easy to understandThis question was posed to me in an interview.The query is from Sorting in chapter Sorting of Data Structures & Algorithms II |
|
Answer» Correct option is (a) Because insertion sort is faster and adaptive |
|
| 226. |
Which of the following algorithm is implemented internally in java when we use function arrays.sort()?(a) intro sort(b) quick sort(c) tim sort(d) merge sortThis question was posed to me in exam.I need to ask this question from Sorting topic in chapter Sorting of Data Structures & Algorithms II |
|
Answer» The CORRECT answer is (c) TIM sort |
|
| 227. |
What is the auxiliary space requirement of Tim sort?(a) O(n)(b) O(n log n)(c) O(n^2)(d) O(log n)This question was posed to me by my school principal while I was bunking the class.Query is from Sorting in portion Sorting of Data Structures & Algorithms II |
|
Answer» The correct choice is (a) O(N) |
|
| 228. |
What is the average time complexity of Tim sort?(a) O(n)(b) O(n log n)(c) O(n^2)(d) O(log n)I have been asked this question by my college director while I was bunking the class.My enquiry is from Sorting topic in chapter Sorting of Data Structures & Algorithms II |
|
Answer» CORRECT answer is (b) O(n log n) EXPLANATION: Average time complexity of TIM SORT remains to be O(n log n). It is the same as the average case complexity of merge sort. |
|
| 229. |
What is the worst case time complexity of Tim sort?(a) O(n)(b) O(n log n)(c) O(n^2)(d) O(log n)The question was asked by my college director while I was bunking the class.I'd like to ask this question from Sorting in chapter Sorting of Data Structures & Algorithms II |
|
Answer» Right choice is (b) O(N log n) |
|
| 230. |
What is the best case time complexity of Tim sort?(a) O(n)(b) O(n log n)(c) O(n^2)(d) O(log n)The question was posed to me by my college director while I was bunking the class.My question is taken from Sorting in division Sorting of Data Structures & Algorithms II |
|
Answer» Right OPTION is (a) O(N) |
|
| 231. |
Tim sort is a comparison based sort.(a) true(b) falseI got this question in an online quiz.Asked question is from Sorting in chapter Sorting of Data Structures & Algorithms II |
|
Answer» Right answer is (a) true |
|
| 232. |
Which of the following sorting algorithm is not in-place?(a) insertion sort(b) tim sort(c) quick sort(d) intro sortThe question was asked in class test.My question is based upon Sorting topic in portion Sorting of Data Structures & Algorithms II |
|
Answer» Right CHOICE is (B) tim sort |
|
| 233. |
Which of the following sorting algorithm is stable?(a) Tim sort(b) Introsort(c) Quick sort(d) Heap sortThis question was addressed to me during an internship interview.Origin of the question is Sorting in portion Sorting of Data Structures & Algorithms II |
|
Answer» The correct answer is (a) Tim sort |
|
| 234. |
Tim sort begins sorting the given array by using which of the following sorting algorithm?(a) selection sort(b) quick sort(c) insertion sort(d) merge sortI have been asked this question during a job interview.I'm obligated to ask this question of Sorting topic in portion Sorting of Data Structures & Algorithms II |
|
Answer» The correct OPTION is (C) insertion sort |
|
| 235. |
Which of the following sorting algorithm is a constituent of tim sort?(a) selection sort(b) quick sort(c) merge sort(d) heap sortI have been asked this question in an interview.My enquiry is from Sorting in section Sorting of Data Structures & Algorithms II |
|
Answer» The correct CHOICE is (c) merge sort |
|
| 236. |
Which of the following is Python’s standard sorting algorithm?(a) quick sort(b) introsort(c) merge sort(d) tim sortThe question was posed to me by my college director while I was bunking the class.My doubt stems from Sorting in chapter Sorting of Data Structures & Algorithms II |
|
Answer» The correct choice is (d) tim sort |
|
| 237. |
Which of the following sorting algorithm will be preferred when the size of partition is between 16 and 2 log(n) while implementing introsort?(a) quick sort(b) insertion sort(c) heap sort(d) merge sortThe question was asked by my school principal while I was bunking the class.Origin of the question is Sorting topic in section Sorting of Data Structures & Algorithms II |
|
Answer» The correct answer is (a) quick sort |
|
| 238. |
What is the cut-off for switching from quick sort to heap sort in the implementation of introsort?(a) 16(b) n^2(c) n log(n)(d) 2 log (n)I have been asked this question in quiz.My question is taken from Sorting topic in chapter Sorting of Data Structures & Algorithms II |
|
Answer» Correct answer is (d) 2 log (n) |
|
| 239. |
What is the cut-off for switching from quick sort to insertion sort in the implementation of introsort?(a) 4(b) 8(c) 16(d) 32The question was posed to me in an interview for job.Question is from Sorting topic in chapter Sorting of Data Structures & Algorithms II |
|
Answer» RIGHT option is (c) 16 For explanation: When small ARRAYS needs to be sorted then INSERTION sort proves to be the best choice. So when the size of the partition is less than 16 INTROSORT switches to insertion sort. This particular value has been deduced EXPERIMENTALLY. |
|
| 240. |
Why is insertion sort preferred over other sorting algorithms (like selection sort, bubble sort etc.) for introsort implementation?(a) Because insertion sort is faster and adaptive(b) Because insertion sort requires less space(c) Because insertion sort is easy to implement(d) Because insertion sort is easy to understandThis question was posed to me in an online interview.This key question is from Sorting in section Sorting of Data Structures & Algorithms II |
|
Answer» Right answer is (a) Because insertion SORT is faster and adaptive |
|
| 241. |
Why is heap sort preferred over merge sort for introsort implementation?(a) Because heap sort is faster(b) Because heap sort requires less space(c) Because heap sort is easy to implement(d) Because heap sort is easy to understandI had been asked this question by my college director while I was bunking the class.Query is from Sorting in division Sorting of Data Structures & Algorithms II |
|
Answer» CORRECT answer is (b) Because heap sort REQUIRES less space Best explanation: Both heap sort and merge sort have the same time complexity. But heap sort is an in-place sorting ALGORITHM whereas merge sort requires O(n) AUXILIARY space which makes heap sort a more preferable option. |
|
| 242. |
What is the auxiliary space requirement of introsort?(a) O(n)(b) O(n log n)(c) O(n^2)(d) O(log n)This question was addressed to me in final exam.Question is taken from Sorting topic in chapter Sorting of Data Structures & Algorithms II |
|
Answer» Correct CHOICE is (d) O(log N) |
|
| 243. |
What is the average time complexity of introsort?(a) O(n)(b) O(n log n)(c) O(n^2)(d) O(log n)The question was asked in semester exam.The query is from Sorting topic in portion Sorting of Data Structures & Algorithms II |
|
Answer» Right ANSWER is (b) O(n log n) |
|
| 244. |
What is the worst case time complexity of introsort?(a) O(n)(b) O(n log n)(c) O(n^2)(d) O(log n)The question was asked by my college professor while I was bunking the class.I'm obligated to ask this question of Sorting topic in section Sorting of Data Structures & Algorithms II |
|
Answer» Correct choice is (b) O(N log n) |
|
| 245. |
What is the best case time complexity of introsort?(a) O(n)(b) O(n log n)(c) O(n^2)(d) O(log n)The question was posed to me in my homework.Query is from Sorting topic in portion Sorting of Data Structures & Algorithms II |
|
Answer» The CORRECT choice is (B) O(n LOG n) |
|
| 246. |
Introsort sort is a comparison based sort.(a) true(b) falseI got this question in an online quiz.I would like to ask this question from Sorting topic in division Sorting of Data Structures & Algorithms II |
|
Answer» Right answer is (a) true |
|
| 247. |
Which of the following sorting algorithm is in-place?(a) intro sort(b) merge sort(c) counting sort(d) radix sortThe question was posed to me in an interview for internship.The question is from Sorting in portion Sorting of Data Structures & Algorithms II |
|
Answer» CORRECT option is (a) intro sort For explanation: INTROSORT may use quick sort or heap sort or insertion sort internally in order to sort the GIVEN INPUT. All of the three algorithms are in PLACE, thus making introsort to be an in-place sorting algorithm. |
|
| 248. |
Which of the following sorting algorithm is NOT stable?(a) Introsort(b) Brick sort(c) Bubble sort(d) Merge sortThis question was addressed to me in unit test.My enquiry is from Sorting topic in portion Sorting of Data Structures & Algorithms II |
|
Answer» Right option is (a) Introsort |
|
| 249. |
Introsort begins sorting the given array by using which of the following sorting algorithm?(a) selection sort(b) quick sort(c) insertion sort(d) heap sortI have been asked this question in final exam.Question is taken from Sorting in chapter Sorting of Data Structures & Algorithms II |
|
Answer» Correct choice is (B) QUICK sort |
|
| 250. |
Which of the following sorting algorithm is used by C++ internally?(a) quicksort(b) introsort(c) merge sort(d) heap sortThe question was asked during a job interview.I'm obligated to ask this question of Sorting topic in section Sorting of Data Structures & Algorithms II |
|
Answer» Right option is (B) INTROSORT |
|