For the list shown below demonstrate the following sort 64 1

 For the list shown below, demonstrate the following sort:    64, 12, 68, 23, 97, 38, 81, 76, 55, 32, 48, 29, 46     Quick sort  (as slide 45).  Use median-of-three and continue          until the list is sorted.  If a partition size is <= 3, just          put the partition in sorted order. 

Solution

Quick sort of the given list:

64, 12, 68, 97, 38, 81, 76, 55, 32, 48, 29, 46

Now, let 64 be the pivot element.

Compare every element in the list with of array with the pivot element.

Then, the immediate element is 12<64

Goto next element. 68>64

Search from last element.46<64

Swap 46 and 68.

Similarly, continuing then we get

after swapping we get

12, 23, 29, 32, 38, 46, 48, 55, 64, 68, 76, 81, 97

 For the list shown below, demonstrate the following sort: 64, 12, 68, 23, 97, 38, 81, 76, 55, 32, 48, 29, 46 Quick sort (as slide 45). Use median-of-three and

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site