Win a copy of Head First Android this week in the Android forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Array

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a float array contaning values 41.96,43.94,15.87,21.56,5.90
now how can i rank them without shufling the values.like while traversing the array it should print:
41.96- 2
43.94- 1
15.87- 4
21.56- 3
5.90 - 5
please some one help as i have to submit this assignment soon.
 
Ranch Hand
Posts: 522
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by alec stewart stewart:
I have a float array contaning values 41.96,43.94,15.87,21.56,5.90
now how can i rank them without shufling the values.like while traversing the array it should print:
41.96- 2
43.94- 1
15.87- 4
21.56- 3
5.90 - 5
please some one help as i have to submit this assignment soon.


Hi Alec, it is an assignement you should try to do it yourself, right .
To put you on the right track try searching for the following algorithms, and implement them in JAVA:
1) Bubble Sort.
2) Radix Sort.
3) Insertion Sort.
4) Quick Sort.
Good Luck.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic