Analysis of Algorithms : An Active Learning Approach

(Ron) #1
RESULTS OF CHAPTER STUDY SUGGESTIONS 267

Shellsort


Heapsort


The Original List:62471385
After using increment of 7:52471386
After using increment of 3:51372486
After using increment of 1:12345678

The Original List: 15 4 1 0869161731114251213
After using
increment of 15: 13 4 1 0869161731114251215
After using
increment of 7: 14386251271011149161315
After using
increment of 3: 14256381179121310161415
After using
increment of 1: 12345678910111213141516

The Original List:62471385
After heap construction:87651342
Pass 1:75621348
Pass 2:65421378
Pass 3:53421678
Pass 4:43125678
Pass 5:32145678
Pass 6:21345678
Pass 7:12345678

The Original List: 15 4 1 0869161731114251213
After heap
construction: 16 13 15 8 11 14 1 24736925101
Pass 1: 15 13 14 8 11 9 1 247361251016
Pass 2: 14 13 12 8 11 9 1 047361251516
Pass 3: 13 11 1 286910473512141516
Pass 4: 12 11 1 086924735113141516
Pass 5: 11 8 1 0769241351213141516
Free download pdf