Standard Algorithms Flashcards

1
Q

Define

Insertion sort

A

A simple sorting algorithm that works similarly to the way you sort playing cards in your hands. The array is virtually split into a sorted and an unsorted part. Values from the unsorted part are picked and placed in the correct position in the sorted part.

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

Define

Selection sort

A

The algorithm repeatedly selects the smallest (or largest) element from the unsorted portion of the list and swaps it with the first element of the unsorted part. This process is repeated for the remaining unsorted portion until the entire list is sorted.

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

Define

Bubble sort

A

The simplest sorting algorithm, it works by repeatedly swapping the adjacent elements if they are in the wrong order. This algorithm is not suitable for large data sets as its average and worst-case time complexity is quite high.

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

Define

Binary search

A

An efficient algorithm for finding an item from a sorted list of items. It works by repeatedly dividing in half the portion of the list that could contain the item, until it has narrowed down the possible locations to just one.

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

Define

Linear Search

A

A sequential search algorithm that starts at one end and goes through each element of a list until the desired element is found. Otherwise, the search continues till the end of the data set.

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