Searching and sorting algorithms Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Binary search is a ‘divide and conquer’ algorithm which requires the initial array to be sorted before searching. It is called binary because it splits the array into two halves as part of the algorithm. Initially, a binary search will look at the item in the middle of the array and compare it to the search terms.

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

A linear search is the simplest method of searching a data set. Starting at the beginning of the data set, each item of data is examined until a match is made. Once the item is found, the search ends. A way to describe a linear search would be: Find out the length of the data set.

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

Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order. The pass through the list is repeated until the list is sorted.

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

A merge sort is a more complex sort, but also a highly efficient one. A merge sort uses a technique called divide and conquer. The list is repeatedly divided into two until all the elements are separated individually. Pairs of elements are then compared, placed into order and combined.

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

Insertion sort is a simple sorting algorithm that builds the final sorted array one item at a time. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort.

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