[go: up one dir, main page]

0% found this document useful (0 votes)
6 views8 pages

Sorting Algorithms Flashcards

For tech hr sorting based questions

Uploaded by

Sabarimani .B
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views8 pages

Sorting Algorithms Flashcards

For tech hr sorting based questions

Uploaded by

Sabarimani .B
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Bubble Sort

Compares adjacent elements and swaps them.

Best: O(n), Worst: O(n²)

Stable: Yes, In-place: Yes


Selection Sort

Selects the minimum and places it in position.

Time: O(n²)

Stable: No, In-place: Yes


Insertion Sort

Inserts elements in their correct position.

Best: O(n), Worst: O(n²)

Stable: Yes, In-place: Yes


Merge Sort

Divide and conquer. Merges sorted halves.

Time: O(n log n)

Stable: Yes, In-place: No


Quick Sort

Divides using a pivot. Partitions around pivot.

Best/Average: O(n log n), Worst: O(n²)

Stable: No, In-place: Yes


Heap Sort

Builds a heap and sorts by extracting max.

Time: O(n log n)

Stable: No, In-place: Yes


Stable Sort

Maintains the relative order of equal elements.

Useful in multi-key sorting.


In-place Sort

Uses a constant amount of extra space.

Does not use additional data structures.

You might also like