One can sort an array a[ ] as follows.Start by observing that at stage 0,the array segment consisting of the single element a[0] is sorted.Now suppose that at the stage k,the segment a[0..k] is sorted.Take the element a[k+1],and call it X.By moving some of the elements in a[0..k] one place to the right,create a place to put X in so that now a[0..k+1] is sorted.The algorithm that uses this strategy is called
A) bubble sort
B) insertion sort
C) selection sort
D) Quicksort
Correct Answer:
Verified
Q2: The bubble sort algorithm works by
A) repeatedly
Q3: When applied to an array a[ ]
Q4: A search for an item X in
Q5: The selection sort algorithm works by
A) repeatedly
Q6: Consider the following implementation of insertion sort:
Public
Q7: The role of the partition(array,start,end)method in Quicksort
A)
Q8: The binary search algorithm
A) cannot be used
Q9: Assuming a method
Int findMax(int array[ ],int last)that
Q10: An array a[ ] of N elements
Q11: The Quicksort algorithm works by
A) repeatedly comparing
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents