Home

About

Advanced Search

Browse by Discipline

Scientific Societies

E-print Alerts

Add E-prints

E-print Network
FAQHELPSITE MAPCONTACT US


  Advanced Search  

 
Written 6 Page 1 CS 2420 Fall 2010
 

Summary: Written 6 Page 1
CS 2420 Fall 2010
Written 6 10 Points **Due at Classtime** \ Late assignments are NOT accepted
1. Timsort implements merging to minimize the amount of extra space required. For the
example below, write the code to do the merge and minimize auxiliary storage.
4 6 11 13 19 22 25 27 31 35 1 3 7 8 45
left mid right
2. With quicksort, show what happens after the call to partition using the data below. Use
the following algorithm for partition
int partition(int list[], int left, int right)
{ k = (left+right)/2;
swap(&list[left],&list[k]); // move pivot to left location
key = list[left];
i = left+1;
j = right;
while(i <= j)
{ while((i <= right) && (list[i] <= key))
i++;
while((j >= left) && (list[j] > key))
j--;

  

Source: Allan, Vicki H. - Department of Computer Science, Utah State University

 

Collections: Computer Technologies and Information Sciences