• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help with sort function  RSS feed

 
Joel Allison
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm writing a program that is supposed to sort data by population, and by alphabetical order. I can't get it to work though, I think it is specifically my sort functions.



And



I tried to walkthrough these, and I think something is wrong with them. I don't think they fully sort my list, any help would be greatly appreciated.
 
Campbell Ritchie
Marshal
Posts: 55772
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What sort algorithm are you using?
 
Amarnath Pandi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you explain little more about the code.

in sortByPopulation,
You are comparing b[] but only swapping a and b. is it OK? In this case b[] values will not be changed right?
What is in a[] and b[]?

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!