{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

f35-frosh-sem-sorting-nets-handout

# f35-frosh-sem-sorting-nets-handout - May 2011 Sorting...

This preview shows pages 1–4. Sign up to view the full content.

May 2011 Sorting Networks Handout Rearranging Trains B A D C Stub or lead B A D C Sorted order B A D C Stub or lead Stack or LIFO data structure in CE B A D C Stub or lead Question: Is there an ordering that cannot be sorted using a stub? Devising a sorting algorithm B A D C Siding Queue or FIFO B A D C Track Train cars Engine

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

View Full Document
May 2011 Sorting Networks Handout Delivering Train Cars in a Specific Order 1 B A D C 2 3 Cars in the train below have been sorted according to their delivery points. However, it is still nontrivial to deposit car A in stub 1, car B in stub 2, and car C in siding 3. Cars can be pulled or pushed by the engine. 1 2 3 1 2 3 Is there a better initial ordering of the cars for the deliveries in this puzzle?

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: May 2011 Sorting Networks Handout Train Passing Puzzle The trains below must pass each other using a siding that can hold only one car or one engine. Show how this can be done. B A 2 1 May 2011 Sorting Networks Handout A 16-Input Sorting Network 5 10 8 12 6 14 2 7 4 15 9 1 11 13 3 Use 4-input sorters, follow by (4, 4)-mergers, and end with an (8, 8)-merger Using the 0-1 principle, we can validate this network via 16 + 25 + 81 tests 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 5 8 10 12 2 6 7 14 1 4 9 15 3 11 13 2 5 6 7 8 10 12 14 1 3 4 9 11 13 15 4-sorter tests (4, 4)-merger tests (8, 8)-merger tests...
View Full Document

{[ snackBarMessage ]}