1 / 5

Decision Maths 1

Decision Maths 1. Sorting Algorithm Shuttle Sort. Compare items 1 and 2; swap them if necessary Compare 2 and 3; swap if necessary; then 1 and 2 again; Compare 3 and 4, then 2 and 3, then 1 and 2; etc. This is an adaption of the Bubble sort, it sorts the sub list fully for each pass.

spike
Download Presentation

Decision Maths 1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Decision Maths 1 Sorting Algorithm Shuttle Sort • Compare items 1 and 2; swap them if necessary • Compare 2 and 3; swap if necessary; then 1 and 2 again; • Compare 3 and 4, then 2 and 3, then 1 and 2; • etc. • This is an adaption of the Bubble sort, it sorts the sub list fully for each pass. A V Ali : www.2july-maths.co.uk

  2. Shuttle Sort 12 5 3 9 5 7 No sort needed 5 12 3 9 Pass 1 5 7

  3. 5 12 3 9 Sort needed 5 7 No sort needed 7 12 3 9 5 5 Pass 2

  4. Pass 4 7 12 3 9 No sort needed 5 5 Sort needed 7 12 3 9 5 5 Sort needed 7 3 12 9 5 5 Pass 5 Sort needed 3 7 12 9 5 5 Sort needed 5 7 12 9 5 3

  5. Sort needed 5 7 12 9 3 5 5 7 9 12 No sort needed 3 5 Pass 6 5 7 9 12 3 5 Sorted !!

More Related