• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Having trouble with bubble sort list wise (selection sort)

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The code below is for a bubble sort list wise (selection sort). I've gone over it multiple times but I don't know why it doesn't sort the numbers from ascending order. Below is the code and its output. What do you think is causing this? This by the way is from a youtube video.

BUBBLE SORT CODE LIST WISE (SELECTION SORT):


OUTPUT:
run:
Array before sorting:
1 6 5 8 9 4 3 2
*************************************
Array after sorting with bubble sort
1 6 5 8 9 4 3 2




 
Aron Silvester
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Aron Silvester wrote:The code below is for a bubble sort list wise (selection sort). I've gone over it multiple times but I don't know why it doesn't sort the numbers from ascending order. Below is the code and its output. What do you think is causing this? This by the way is from a youtube video.

BUBBLE SORT CODE LIST WISE (SELECTION SORT):


OUTPUT:
run:
Array before sorting:
1 6 5 8 9 4 3 2
*************************************
Array after sorting with bubble sort
1 6 5 8 9 4 3 2







Never mind I figured it out. Thanks.
 
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And what was your solution?
reply
    Bookmark Topic Watch Topic
  • New Topic