You are on page 1of 7

Insertion Sort:

Starting with an unsorted group of data, choose one card at random to begin your “sorted list”. In the
example below, 7 was chosen as the first sorted number (no comparisons have happen yet).

Then choose the next random unsorted card and compare it to our “sorted list” (which is only one card
at this point). Start by comparing it to sorted list until it cannot go any lower. In the example below, the
second card chosen is 3. Compare that to the first number in the sorted list (7) if it is lower move to the
next number in the list or until it reaches the left end of the list.

7
3

3 7
Repeat this with unsorted cards until you sort the entire group. The next card chosen is 4. We compare
that to the first number in the sorted list (7). Since it is lower than the first card, we move to the next
card in the list (3). When we compare these, we know that our chosen card is larger than the second
card in the list, so it can’t go this low and we have found its spot.

3 7
4

3 4 7

The next card chosen is the 1. It is compared the first card (7), it is lower so it goes further left. It is
compared to the second card (4), it is lower so goes further to the left. It is compared to the third card
(3), it is lower so it goes further left. It is as far left as possible so it is now the lowest sorted card.

1 3 4 7
Bubble Sort:
With a line of unsorted cards, start at the left end and compare the first two cards and switch the cards if
the HIGHER card is on the left (meaning the higher card should go to the right). Then compare the
second and third cards and switch them if the HIGHER card is on the left. Then compare the third and
fourth cards and switch them if the HIGHER card is on the left. Continue this through the entire list.
When you finish with the first pass through, start again from the left and repeat the process. The list is
sorted when you do not switch ANY cards.

3 2

Switch these cards

3 6

Don’t switch these


cards

6 4

Switch these cards

6 1

Switch these cards


Merge Sort:
Start with 8 groups (each card starts as its own group). Then merge the 8 groups into 4 groups by
comparing two cards next to each other and placing the lower number on the left. You will end up with 4
sorted groups.

3 7 6 4

3 7 4 6

Then merge the 4 sorted groups in 2 sorted groups by comparing the furthest left card of the both of two
groups. Example below: first 3 is compared with 4, and the 3 is taken. Then the 7 is compared with 4,
and the 4 is taken. Then the 7 is compared to 6, and the 6 is taken. The 7 is left as the last card so you
know it is the highest card in that group now.

3 7 4 6

3 4 6 7

Continue merging groups until there is one large sorted group.


Names: Azucena Alonso

Every time you look at two cards to see which is higher/lower, that is a comparison!
Once EVERY card has been sorted and all cards are in order, that is an attempt!

Selection Sort: You have a group of unsorted data (the cards). Choose two, compare them,
and keep the lower number in your hand and put the other card down. Pick up the next card in
the unsorted group, compare them, and keep the lower number in your hand and put the other
card down. Repeat that process until you have gone through the entire group and you will end
up with the lowest card of the group. That card is now sorted, put it at the left end of the line.
Repeat this process with the remaining unsorted group to find the second lowest card, then the
third lowest, and so on until the entire group is sorted. Record your findings below:

Team 1 (Put names here) Team 2 (Put names here)

Attempt # of comparisons Attempt # of comparisons

1 13 1 13

2 10 2 6

3 8 3 8

Average: 10 Average: 9

Quicksort: Choose one card at random. Compare each card to the card you choose creating
two groups: cards that have lower number are put into a group to the left of the chosen card,
and cards that are larger to the right of the chosen card (the groups may end up uneven and
that is OK). The chosen card is now sorted because we know which cards are lower than it and
which cards are higher. Repeat this comparison method with one of the unsorted groups (if you
choose the group of lower numbered cards, cards lower than the chosen card will be put further
to the left and cards higher than the chosen card will be placed between the card in your hand
and the original chosen card). Repeat this until all cards are sorted. Record your findings:

Team 1 (Azucena) Team 2 (Isis)

Attempt # of comparisons Attempt # of comparisons

1 19 1 18

2 18 2 19

3 14 3 20

Average: 17 Average: 19

Sorting Method of Your Choice (Selection Sort):


Team 1 (Azucena) Team 2 (Azucena)

Attempt # of comparisons Attempt # of comparisons

1 15 1 16

2 18 2 13

3 11 3 9

Average: 14 Average: 12

Of the three methods, which method do you prefer? (things to consider: easiness, consistency,
number of comparisons, etc)

Student #1 (Azucena Alonso): The method I prefer was the selection sort because as you can
see from my data, doing the selection sort was faster and had less number of comparisons,
meaning that the selection sort is an easier and faster process than the quicksort method.

Student #2 (replace this with your name):

Student #3 (replace this with your name):

Student #4 (replace this with your name):

Optional: TRY MORE CARDS!!!!!


Team 1 (Put names here the Team 2 (Put names here AND
number of cards) number of cards)

Attempt # of comparisons Attempt # of comparisons

1 1

2 2

3 3

Average: Average:

You might also like