2.1.3 Searching and Sorting algorithms Flashcards

1
Q

What are the two searching algorithms?

A

Binary search
Linear search

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

What is a Binary search?

A

looks for a specific value in an ordered or sorted list

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

What is a Binary search?

A

looks for a specific value in an ordered or sorted list

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

How does a binary search take place?

A

Comparing it with the middle or median value and deciding if it is higher or lower

Taking the half of the list that is higher or lower and once again finding and comparing it with the middle or median value

Repeating this process until the specific value is found

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

How does a linear search take place?

A

takes each value in a list, one at a time, and compares it with the value required, this is repeated until the correct value is found

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

What are the characteristics of a linear search?

A

process can be very slow, especially with large data sets

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

How does a bubble sort take place?

A

The first two values in a list are compared with each other and are swapped if they are in the wrong order. Then the next pair of values is checked and their order in the list is swapped, if required. This process is repeated unto no further swapes are needed and the list is sorted

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

How does a Merge sort take place?

A

data is repeatedly split into halves until each list contains only one item. The items are then merged into the order required.

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

How does an Insertion sort take place?

A

Each item in an unordered list is examined in turn and compared with the previous items in the list. Higher values than those before them are left in the same position, but lower values are compared with each in turn until they can be inserted into the correct place. This process is repeated until all items have been examined and inserted into their correct position, in ascending order.

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