• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

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: 76862
366
  • 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?
 
Without subsidies, chem-ag food costs four times more than organic. Or this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic