answersLogoWhite

0

If they're in an array, use java.util.Arrays.sort(). If they're in a Collection, as in java.util.Collection, use java.util.Collections.sort().

If you want an actual algorithm, try a for-each loop with an equivalence operator and conditional switch.

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

A C program using dynamic memory allocation to sort n names in ascending order?

Writing a C program that uses dynamic memory allocation to sort names in ascending order is a typical computer science assignment. To write this program, you must be in UNIX.


Write an Assembly language program which implements sorting algorithm both ascending and descending order and display those numbers with certain delay say of 5sec between successive displays?

das


How do you write polynomials in ascending and descending order?

before and after use an conpair the results


How do you write Ascending order program using 8086 microprocessor?

One many find this answer on YouTube. One also may find out how to write ascending order programs using an 8086 microprocessor by looking at the owners manual.


Write 0.1 0.01 0.9 and 0.09 in ascending order?

0.01, 0.09, 0.1, 0.9


What is algorithm to write algorithm to the program to access a pointer variable in structure?

Here is the algorithm of the algorithm to write an algorithm to access a pointer in a variable. Algorithmically.name_of_the_structure dot name_of_the _field,eg:mystruct.pointerfield


What is algorithams?

Algarithm: Algorithm is process to solve the problem in a step by step order Algorithm is used to write the program in a computer language. thrinath.sachin@gmail.com


Write an algorithm to find the root of quadratic equation?

Write an algorithm to find the root of quadratic equation


What are ascending factors?

Ascending means to write the factors from least to greatest.


How to write a pseudocode algorithm effectively?

To write a pseudocode algorithm effectively, start by clearly defining the problem and breaking it down into smaller steps. Use descriptive variable names and comments to explain each step. Keep the algorithm simple and easy to understand, and test it with different inputs to ensure it works correctly.


A Write the algorithm to concatenate two given strings?

a write the algorithm to concatenate two given string


Sort the array of integers in Descending order?

Make use of Java's robust library: // filled with various ints int[] a; // temporary variable for swapping values int temp; // sort with fast, built-in algorithm java.util.Arrays.sort(a); // reverse the array for( int i = 0; i < a.length/2; ++i ) { temp = a[i]; a[i] = a[a.length - i - 1]; a[a.length - i - 1] = temp; } Obviously, if you're concerned with execution speed you could write your own sort method which would sort into descending order instead of ascending order (perhaps by modifying Java's sort algorithm).