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 r advatages of websphere? & how to deploy?
From the two, which would be easier to write: synchronization code for ten threads or two threads?
what is method reference in java 8?
What are white spaces in java?
What is the difference between pass by reference and pass by pointer?
What is volatile keyword in java
why constructor dont have returns type?
What is meant by serialisation and deserialisation?
Features of JAVA ? In which version of java synchronizedXXX() methods are included in Collections class.
Explain about map interface in java?
What is the difference between DataInputStream and BufferedReader
How many types of variables are there?