If I have 1000 objects and my requirement is to sort them
quickly, then which collection would you recommend and why?
Answers were Sorted based on User's Feedback
Answer / sanjay
The question is about collection and not about the algorithm - My answer is array or arrayList. arraylist is backed by an array so it will have identical performance to an array.
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / shankar
quick.it has the least time complexity and with the help
of pivot elements it gets sorted vvery easily.the time
complexity is log2n
Is This Answer Correct ? | 2 Yes | 3 No |
Answer / sanjay
ArrayList. indexing is easy, count of objects is already known.
Is This Answer Correct ? | 0 Yes | 3 No |
Answer / muni sankar
Heapsort is one of the best general-purpose sorting
algorithms, a comparison sort and part of the selection sort
family. Although somewhat slower in practice on most
machines than a good implementation of quicksort, it has the
advantages of worst-case O(n log n) runtime and being an
in-place algorithm
Is This Answer Correct ? | 0 Yes | 8 No |
What's the difference between an abstract class and interface in java?
What are the types of exceptions?
What is java util collection?
What Method and class used for Connection pooling ?
What do u mean by wrapper Class? What do u mean by Jvm... How do u change JVM for other OS? Or No need to Change ...? its like tricky
What do you understand by java?
what is the logic inside any default constuctor?
There are 2 different ways to create an object. a)By using keyword "new" b)By using Class.forName ("className").newInstance(); What is the difference between these 2 methods.
What is a line break example?
Explain in detail about encapsulation with an example?
Why collection doesn’t extend cloneable and serializable interfaces?
Differentiate constructor and a method and how are it be used?