This preview shows page 1. Sign up to view the full content.
Unformatted text preview: when it is already sorted. Lets apply the algorithm to an already sorted list. See Figure 9.11. We compare Phil with John and do not swap. We compare John with Jim and do not swap. We compare Jim with Bob and do not swap. We a) First iteration (Sorted elements are shaded.) b) Remaining iterations (Sorted elements are shaded.) RFz R z R9z R z Rhz Phil items John Bob Jim Al RFz R z R9z R z Rhz Phil items John Bob Al Jim RFz R z R9z R z Rhz Phil items John Al Bob Jim RFz R z R9z R z Rhz Phil items Al John Bob Jim RFz R z R9z R z Rhz Al items Phil John Bob Jim RFz R z R9z R z Rhz Al items Phil John Bob Jim RFz R z R9z R z Rhz Al items Bob Phil John Jim RFz R z R9z R z Rhz Al items Bob Jim Phil John RFz R z R9z R z Rhz Al items Bob Jim John Phil...
View
Full
Document
This note was uploaded on 01/13/2011 for the course CSE 1550 taught by Professor Marianakant during the Fall '10 term at York University.
 Fall '10
 MARIANAKANT

Click to edit the document details