week4 - CS 351 -Data Organization and Management ( Section:...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 351 -Data Organization and Management ( Section: 02) LectureNotes, Week 4 Prepared by: Seher BAS /Aysan BAYSAL /Esra DALGIC REPLACEMENT SELECTION SORT (DUE TO Knuth com of ACM,1965) Let m be the number of records to be sorted which can be kept in the main memory. Imagine that these memory locations are registers and assume we can mark them as “on” or “off”. Replacement selection can overlap reading, sorting and writing. The Algorithm: Step1 : The m registers are filled with records from the input to be sorted . Step2: All registers are put into the “on” state. Step3: Select the register which has the smallest of all “on” registers. Step4: Transfer the contents of the selected register to the output (call it as key Y). Step5: Replace the contents of the selected register by the next input record. If new record key > Y Go to step 3 If new record key = =Y Go to step 4 If new record key < Y Go to step 6 Step6: Turn the selected key register “off”. If all registers are now
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/01/2011 for the course CS 351 taught by Professor Fazlıcan during the Spring '11 term at Bilkent University.

Page1 / 4

week4 - CS 351 -Data Organization and Management ( Section:...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online