R
Ray Leon
LESSON 8
Dear Sirs or Madam:
I need some assistance with a bubble sort question that I have completed and
think to be correct. I am just a bit unsure since there is an additional
pass (4th pass) in the original question (below), which make me wonder if
there is something I left out. Any help is greatly appreciated. The actual
document and arrows showing the sorts I have uploaded to my website:
http://www.popeyeray.com/bubblesort.htm
1. Consider an array with these elements: Pebbles, Barney, Wilma, Fred and
Dino. Apply the bubble sort technique to sort the array in alphabetical
order. Show all passes. (List the order before and after each pass). (50
points)
Original List
J = 1
J = 2
J = 3
J = 4
Pebbles
Barney
Barney
Barney
Barney
First
Barney
Pebbles
Pebbles
Pebbles
Pebbles
Pass
Wilma
Wilma
Wilma
Fred
Fred
Fred
Fred
Fred
Wilma
Dino
Dino
Dino
Dino
Dino
Wilma
J = 1
J = 2
J = 3
Barney
Barney
Barney
Barney
Second
Pebbles
Fred
Fred
Fred
Pass
Fred
Pebbles
Dino
Dino
Dino
Dino
Pebbles
Pebbles
Wilma
Wilma
Wilma
Wilma
Barney
Barney
Barney
Third
Fred
Dino
Dino
Pass
Dino
Fred
Fred
Pebbles
Pebbles
Pebbles
Wilma
Wilma
Wilma
Fourth
Pass
Dear Sirs or Madam:
I need some assistance with a bubble sort question that I have completed and
think to be correct. I am just a bit unsure since there is an additional
pass (4th pass) in the original question (below), which make me wonder if
there is something I left out. Any help is greatly appreciated. The actual
document and arrows showing the sorts I have uploaded to my website:
http://www.popeyeray.com/bubblesort.htm
1. Consider an array with these elements: Pebbles, Barney, Wilma, Fred and
Dino. Apply the bubble sort technique to sort the array in alphabetical
order. Show all passes. (List the order before and after each pass). (50
points)
Original List
J = 1
J = 2
J = 3
J = 4
Pebbles
Barney
Barney
Barney
Barney
First
Barney
Pebbles
Pebbles
Pebbles
Pebbles
Pass
Wilma
Wilma
Wilma
Fred
Fred
Fred
Fred
Fred
Wilma
Dino
Dino
Dino
Dino
Dino
Wilma
J = 1
J = 2
J = 3
Barney
Barney
Barney
Barney
Second
Pebbles
Fred
Fred
Fred
Pass
Fred
Pebbles
Dino
Dino
Dino
Dino
Pebbles
Pebbles
Wilma
Wilma
Wilma
Wilma
Barney
Barney
Barney
Third
Fred
Dino
Dino
Pass
Dino
Fred
Fred
Pebbles
Pebbles
Pebbles
Wilma
Wilma
Wilma
Fourth
Pass