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 is the difference between array and stack?

744


Why is it called bubble sort?

683


What happens if an array goes out-of-bounds?

826


Define biconnectivity?

685


Differentiate between iterator and enumeration.

690


Are sets sorted?

693


What are the types of binary tree?

676


Explain extended binary tree.

719


What should I learn first data structures or algorithms?

773


How can you implement a stack?

806


What is a threaded binary tree? Explain its operation with example?

886


What is difference between data type and data structure?

578


What is array simple?

685


Define primary clustering?

709


What is long data type?

657