Bubble Selection Insertion Sort - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

Bubble Selection Insertion Sort

Description:

It is based on traversing an array and switching adjacent pairs of ... HSC Computing Chivers, Lawrence, Reagan, Ware. Methods of Algorithm Description. 1. 2 ... – PowerPoint PPT presentation

Number of Views:999
Avg rating:3.0/5.0
Slides: 13
Provided by: smadsenill
Category:

less

Transcript and Presenter's Notes

Title: Bubble Selection Insertion Sort


1
Bubble Sort
The Bubble Sort is popular among novice
programmers and is reasonably efficient. It is
based on traversing an array and switching
adjacent pairs of values that are not in the
correct order. After ONE traversal, the largest
value will have bubbled to the end of the
array. (Ascending order)
2
Watch for the swapping of numbers. Click the
mouse when swap or No swap appears
Bubble Sort
13
23
12
6
40
5
10
32
9
12
23
6
23
5
40
10
40
32
40
9
40
13
40
Pass
1st
6
12
5
23
10
23
9
32
13
32
Pass
2nd
5
12
10
12
9
29
13
23
Pass
3rd
3
5
6
9
12
Pass
4th
9
10
Pass
5th
Bubble Sort Completed
4
Selection Sort
In a Selection Sort, we place a marker at the
first cell in the array and search through the
array from that position for the smallest
value. When the smallest value is found, it is
swapped with the marked cells value. This
places the smallest value at the front of the
array. Next, the marker is moved to the next
cell and the process is repeated. When the
marker reaches the last cell, the sorting process
is completed. . .
5
Watch for the swapping of numbers. Click the
mouse when there is no animation.
6
40
9
13
23
12
5
10
32
5
23
Swapped
6
12
Swapped
6
Watch for the swapping of numbers. Click the
mouse when swapped appears
9
12
10
40
12
23
13
40
23
32
Swapped
Swapped
Swapped
Swapped
Swapped
Selection Sort Completed
7
Insertion Sort
The insertion sort is like inserting a card into
a players hand of cards. To make room for the
card, one moves some cards to the side to make
room for it. Much the same occurs when using an
insertion sort in an array. One item is declared
as sorted. A value is inserted and is compared
with the sorted section of the array. An
inserted value can be repeatedly swapped with the
one left of an inserted value if it is smaller. .
.
8
Click the mouse when there is no animation.
12
23
23
6
6
12
No Change
9
5
40
5
23
5
12
5
6
10
40
10
23
10
12
32
40
10
9
32
40
9
9
22
9
12
9
10
13
40
13
32
13
22
11
Bibliography
Software Design Development HSC Course C.
Wilson Software Design Development HSC
Course S. Davis Software Design Development
HSC Course A. Fowler HSC Computing Chivers,
Lawrence, Reagan, Ware Methods of Algorithm
Description
12
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com