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

Write the algorithm for converting infix expression to postfix expression?

560


What is difference between list and linked list?

539


Why is waste sorting important?

565


What is quick sort?

632


How many parts are there in a declaration statement?

540






There are 2 int type array data type. One is containing 50 elements, and another one is containing 30 elements. Can we assign the array of 50 elements to an array of 30 elements?

846


Describe tree database. Explain its common uses.

553


What is difference between tree and forest?

516


What is a spanning tree in data structure?

525


What are the types of algorithms?

553


Is it possible to make an array volatile in java?

507


How do you perform a merge sort?

480


Where will be the free node available while inserting a new node in a linked list?

572


What is heap tree in data structure?

495


What is the difference between binary tree and binary search tree?

506