How does sort function work?
Answer / Varun Kumar Jha
The sort() method in Java compares each pair of adjacent elements and swaps them if they are in the wrong order (according to their natural order or a specified Comparator). The default natural ordering is implemented by comparing the objects' hash codes, but this can be customized with a Comparator.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is sorting in data structure?
What happens when arraylist is full?
What is the difference between array and stack in data structures?
Briefly explain recursive algorithm?
Can we add duplicate keys in a hashmap? What will happen if we attempt to add duplicate values?
Is it possible to store null key and null values in a hashmap?
What is the purpose of sorting algorithms?
Does arraylist maintain order?
How does quick sort work?
What is binary tree?
What is data structure explain different types of data structures with examples?
In tree construction which is the suitable efficient data structure?