Shuttle Sort Example 1st pass Comparisons: 1

Slides:



Advertisements
Similar presentations
Bubble Sort Example 9, 6, 2, 12, 11, 9, 3, 7 6, 9, 2, 12, 11, 9, 3, 7 Bubblesort compares the numbers in pairs from left to right exchanging.
Advertisements

Early Math OrdinalandCardinalNumbers. Ordinal Numbers Early Math Move one.
By: Masud-ul-Hasan Experiment 8 How will be the shift registers used here?
Let’s repeat the ordinal numbers!
1 st Place Post-Secondary Winner. 2 nd Place Post-Secondary Winner.
Selection and Insertion Sort Mrs. C. Furman October 1, 2008.
Organization In The Body How do we sort it all out?
Lesson Objective: Understand what an algorithm is and be able to use them to solve a simple problem.
Are You Smarter Than a 5 th Grader? 1,000,000 5th Grade 5th Grade Equations 5th Grade 5th Grade Equations 5th Grade 5th Grade Equations 4th Grade 4th.
Your text here Agenda. Topic One Statement Topic Two Statement Topic Three Statement Topic Four Statement.
Bubble Sort. Bubble Sort Example 9, 6, 2, 12, 11, 9, 3, 7 6, 9, 2, 12, 11, 9, 3, 7 6, 2, 9, 12, 11, 9, 3, 7 6, 2, 9, 11, 12, 9, 3, 7 6, 2, 9, 11, 9, 12,
Decision Maths 1 Sorting Algorithm Shuttle Sort A V Ali : 1.Compare items 1 and 2; swap them if necessary 2.Compare 2 and 3; swap.
To know and use the Bubble Sort and Shuttle Sort Algorithms.
Searching & Sorting Programming 2. Searching Searching is the process of determining if a target item is present in a list of items, and locating it A.
1 Introduction to Sorting Algorithms Sort: arrange values into an order Alphabetical Ascending numeric Descending numeric Two algorithms considered here.
Sorting and Searching. Selection Sort  “Search-and-Swap” algorithm 1) Find the smallest element in the array and exchange it with a[0], the first element.
Chapter 8 Sorting and Searching Goals: 1.Java implementation of sorting algorithms 2.Selection and Insertion Sorts 3.Recursive Sorts: Mergesort and Quicksort.
Bubble Sort Example
SORTING ALGORITHMS King Saud University College of Applied studies and Community Service CSC 1101 By: Nada Alhirabi 1.
Sorting Sorting takes an unordered array and makes it an ordered one
Guitar Chords. G First finger 2nd fret, 5 th string. Second finger 3 rd fret, 6 th string. Third finger 3 rd fret, 1 st string.
 Life Expectancy is 180 th in the World.  Literacy Rate is 4 th in Africa.
In the first pass, the first two numbers are compared. The shuttle sort compares the numbers in pairs from left to right exchanging when necessary.
Merge Sort Comparison Left Half Data Movement Right Half Sorted.
The Bubble Sort Mr. Dave Clausen La Cañada High School
Alternate Version of STARTING OUT WITH C++ 4th Edition
Searching and Sorting Algorithms
CMSC201 Computer Science I for Majors Lecture 23 – Sorting
Sequences Saturday, 02 June 2018
Discrete Mathematics Algorithms.
Converse of Hinge Theorem
Use the Binomial Theorem
Use the Binomial Theorem
3.3 Fundamentals of data representation
Consecutive Integer Problems
Bubble Sort Bubble sort is one way to sort an array of numbers. Adjacent values are swapped until the array is completely sorted. This algorithm gets its.
Selection Sort Sorted Unsorted Swap
Click to edit Master text styles
Use the Binomial Theorem
Sequences Friday, 23 November 2018
Shuttle Sort Example 1st pass Comparisons: 1
Mona Lisa Project Using Image Blender to change this famous portrait in four different ways Created by:
Author names here Author association names here
And now for something completely different . . .
Click to edit Master text styles
CS Two Basic Sorting Algorithms Review Exchange Sorting Merge Sorting
Title Slide Alternative 1
Surname 99 NOTES: Point of View
Linear sequences A linear sequence is a name for a list of numbers where the next number is found by adding or subtracting a constant number. Here is an.
Paired Verbal Fluency 3 rounds 1st: Partner A then Partner B
Progression of Text Levels Expected in Grades 1 - 5
4n + 2 1st term = 4 × = 6 2nd term = 4 × = 10 3rd term
Click to edit Master text styles
THIRD WAY TO MAKE MONEY IN DOTERRA
Bubble Sort Example 9, 6, 2, 12, 11, 9, 3, 7 6, 9, 2, 12, 11, 9, 3, 7 Bubblesort compares the numbers in pairs from left to right exchanging.
ОПШТЕСТВО ТЕМА: МЕСТОТО ВО КОЕ ЖИВЕАМ Скопје
AS Maths Decision Paper January 2010 Model Answers.
Searching and Sorting Arrays
Sorting Example Bubble Sort
Author names here Author associations here
Author names here Author associations here
4 Years Milestone plan – (Company Name)
Decision Maths Unit 7 Sorting Algorithms 3. Shell Sort.
Click to edit Master text styles
How to find the nth rule for a linear sequence
Author names here Author associations here
Introduction to Sorting Algorithms
Sequences Wednesday, 22 May 2019
Ordinal Numbers.
Click to edit Master text styles
Presentation transcript:

6 12 9 2 11 3 7 6 9 Shuttle Sort Example 1st pass Comparisons: 1 The shuttle sort compares the numbers in pairs from left to right exchanging when necessary. An additional number is involved in each pass. In the first pass, the first two numbers are compared. The 9 is the larger and so the 9 and the 6 are exchanged. Comparisons: 1 Swaps: 1

9 12 6 2 11 3 7 2 9 12 6 2 11 3 7 6 2 9 Shuttle Sort Example 1st pass 2nd pass In the second pass, the first three numbers are involved. The second and third numbers are compared, and swapped if necessary. Then the first and second numbers are compared, and swapped if necessary. Comparisons: 2 3 1 Swaps: 3 2 1

Shuttle Sort Example 1st pass 9 12 6 2 11 3 7 6 12 2 9 11 3 7 2nd pass 6 12 2 9 11 3 7 3rd pass In the third pass, the third and fourth numbers are compared, and swapped if necessary. No swap is needed in this case, so the third pass ends here. Comparisons: 4 3 Swaps: 3

Shuttle Sort Example 1st pass 9 12 6 2 11 3 7 6 12 2 9 11 3 7 2nd pass 6 12 2 9 11 3 7 3rd pass 6 12 2 9 11 3 7 11 12 4th pass The passes continue in the same way. The fourth pass ends here as no swap is needed. Comparisons: 6 5 4 Swaps: 4 3

Shuttle Sort Example 1st pass 9 12 6 2 11 3 7 6 12 2 9 11 3 7 2nd pass 6 12 2 9 11 3 7 3rd pass 6 11 2 9 12 3 7 4th pass 6 11 2 9 12 3 7 9 9 11 12 5th pass The fifth pass ends here as no swap is needed. Comparisons: 8 7 9 6 Swaps: 6 5 4

Shuttle Sort Example 1st pass 9 12 6 2 11 3 7 6 12 2 9 11 3 7 2nd pass 6 12 2 9 11 3 7 3rd pass 6 11 2 9 12 3 7 4th pass 6 9 2 11 12 3 7 5th pass 6 9 2 11 12 3 7 3 3 6 3 9 3 9 3 11 12 6th pass Comparisons: 12 14 15 13 11 10 9 Swaps: 10 11 9 7 6 8

Shuttle Sort Example 1st pass 9 12 6 2 11 3 7 6 12 2 9 11 3 7 2nd pass 6 12 2 9 11 3 7 3rd pass 6 11 2 9 12 3 7 4th pass 6 9 2 11 12 3 7 5th pass 3 9 2 6 11 12 7 6th pass 3 9 2 6 11 12 7 7 7 9 9 7 11 7 12 7th pass The list is now sorted. Comparisons: 18 17 20 19 15 16 Swaps: 14 15 13 11 12