Sorting Flashcards

1
Q

Average fast runtime for an algorithm:

A

O(N log N)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Sort

A

Method for reorganizing a large number of items into a specific order

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Search

A

Process of finding the required information from a collection of items stored as elements in the computer memory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Selection sort

A

Effective and efficient sort algorithm based on comparison operations.

Best Case: O(n^2)
Average Case: O(n^2)
Worst Case: O(n^2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Insertion Sort

A

sort in c is the simple sorting algorithm that virtually splits the given array into sorted and unsorted parts, then the values from the unsorted parts are picked and placed at the correct position in the sorted part.

Best Case: O(n)
Average Case: O(n^2)
Worst Case: O(n^2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Shell Sort

A

Sorting algorithm that is highly efficient and based on the insertion sort algorithm. This algorithm avoids large shifts, as in insertion sort, where the smaller value is on the far right and must be moved to the far left.

Best Case: O(nlog n)
Average Case: O(n
log n)
Worst Case: O(n^2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Quicksort

A

Quicksort is a highly efficient sorting technique that divides a large data array into smaller ones. A vast array is divided into two array, one containing values smaller than the provided value, say pivot, on which the partition is based. The other contains values greater than the pivot value.

Best Case: O(Nlog N)
Average Case: O(N
log N)
Worst Case: O(n^2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Merge Sort

A

Defined as a sorting algorithm that works by dividing an array into smaller subarrays, sorting each subarray, and then merging the sorted subarrays back together to form the final sorted array.

Best Case: O(Nlog N)
Average Case: O(N
log N)
Worst Case: O(N*log N)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Radix Sort

A

Stable sorting subroutine-based integer sorting algorithm.

Best Case: O(a(n+b))
Average Case: O(p*(n+d))
Worst Case: O(n^2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Heap sort

A

Comparison based sorting technique based on the binary heap data structure.

Best Case: O(Nlog N)
Average Case: O(N
log N)
Worst Case: O(N*log N)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Topological Sort

A

A linear ordering of its vertices such that for every directed edge, uv from vertex u to vertex v, u comes before v in the ordering.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Bubble Sort

A

Works by repeatedly swapping the adjacent elements if they are in the wrong order.

Best Case: O(n^2)
Average Case: O(n^2)
Worst Case: O(n^2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Bucket Sort

A

Best Case: O(n + k)
Average Case: O(n + k)
Worst Case: O(n^2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly