A list is ordered from smaller to largest when a sort is
called. Which sort would take the shortest time to execute?

Answer Posted / ronak & sandip

In this case, both insertion and bubble sort will work exactly same as the time complexity of both method is O(n). But you have to mention one condition to check any swap has been made inside or not...if no swap has been made, it will come out of loop after executing it n times.

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What type of memory allocation is referred for Linked lists?

810


Why null is allowed in hashmap?

466


Why is arraylist faster than linkedlist?

515


What is a stable sorting algorithm?

577


What is Jagged Arrays?

553






Explain multiply linked list in short.

529


What is binary search tree and explain its time complexity?

516


Define union-by-weight?

620


How to increase stack limit in w3wp.exe?

585


List the data structures which are used in network data modal.

481


Explain what are the major data structures used in the network data model?

571


What are the types of queues?

581


What the principle of quick sort and its complexity?

548


Why is null not allowed in concurrenthashmap?

465


Is arraylist faster than array?

462