2.4.6 How standard searching and sorting algorithms work, and the benefits and drawbacks Flashcards

1
Q

State:

Another name for linear search

A

Serial search

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

State:

How a linear search functions

A

Starting at the beginning of the dataset, each value is examined until a match is made

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

Fill The Blank:

Binary Search is a ……. search algorithm and works on the principle of ………… and ………….

A

Fast, Divide, Conquer

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

State:

What is one requirement of Binary Search

A

Data is in a sorted format

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

Fill The Blank:

The search ……….. is repeatedly …………. in half. If the middle value is greater than the value of the search then the interval is changed to the ……….. half of the array. If the middle value is lower than the value of the search then the interval is changed to the ………. half of the array.

This is ………….. until the value is found or the interval is …………

Steps of binary search

A

Interval, Divided, Lower, Upper, Repeated, Empty

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

State:

3 advantages of using linear search

A

3 of:
* List does not have to be ordered
* Fast performance when searching small to medium lsits
* Because list is not sorted, elements can be added and deleted - if needed to be sorted re-ordering would be needed
* Linear search is simpler and easier to implement
* Can be used on any type of data

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

State:

1 advantage of binary search

A

Faster performance than linear search because the data being searched is halfed at each stage

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

State:

1 disadvantage of linear search

A

Very slow when searching lists with large quantitiese of data items

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

State:

1 disadvantage of binary search

A

Data must be ordered/sorted first

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