Top Posters
Since Sunday
New Topic  
Izaganag Izaganag
wrote...
Posts: 686
Rep: 2 0
8 years ago
Which of these methods will sort an array of floats into ascending order?
A) void arrange(float[ ] ary)
{
   for (int n=0; n<ary.length; n++)
      for (int k=n; k<ary.length; k++)
         if (ary[n] < ary[k])
         {
            float x = ary[n];
            ary[n] = ary[k];
            ary[k] = x;
         }
}
B) void arrange(float[ ] ary)
{
   for (int n=1; n<=ary.length; n++)
      for (int k=n; k<ary.length; k++)
         if (ary[n] > ary[k])
         {
            float x = ary[n];
            ary[n] = ary[k];
            ary[k] = x;
         }
}
C) void arrange(float[ ] ary)
{
   for (int n=0; n<ary.length; n++)
      for (int k=n; k<ary.length; k++)
         if (ary[n] > ary[k])
            float x = ary[n];
            ary[n] = ary[k];
            ary[k] = x;
}
D) void arrange(float[ ] ary)
{
   for (int n=0; n<ary.length; n++)
      for (int k=n; k<ary.length; k++)
         if (ary[n] > ary[k])
         {
            float x = ary[n];
            ary[n] = ary[k];
            ary[k] = x;
         }
}
E) none of the above
Textbook 
Java Software Solutions: Foundations of Program Design

Java Software Solutions: Foundations of Program Design


Edition: 7th
Authors:
Read 346 times
3 Replies
Replies
Answer verified by a subject expert
habibtihabibti
wrote...
Top Poster
Posts: 1486
8 years ago
Sign in or Sign up in seconds to unlock everything for free
More solutions for this book are available here
1

Related Topics

Izaganag Author
wrote...
8 years ago
Perfect, what I needed! How do you mark topics solved?
wrote...
8 years ago
Give me a shout if you need anymore help.
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  1227 People Browsing
Related Images
  
 853
  
 403
  
 325
Your Opinion