Top Posters
Since Sunday
w
3
w
3
e
3
3
r
3
g
2
2
b
2
M
2
V
2
f
2
c
2
New Topic  
Izaganag Izaganag
wrote...
Posts: 686
Rep: 2 0
9 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 360 times
3 Replies
Replies
Answer verified by a subject expert
habibtihabibti
wrote...
Top Poster
Posts: 1486
9 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...
9 years ago
Perfect, what I needed! How do you mark topics solved?
wrote...
9 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
  359 People Browsing
 102 Signed Up Today
Related Images
  
 553
  
 998
  
 3174
Your Opinion
Who's your favorite biologist?
Votes: 608