Fundamentals of algorithms- module 2) Searching Flashcards

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

What is searching?

A

Common task for an algorithm.

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

What is an example of searching?

A

1: Phone searches for a signal.
2: Computer searches for an internet link.

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

What are the 2 main types of search algorithm?

A

Binary search.

Linear search.

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

What is a binary search?

A

Chooses the middle value in a sorted array, then works out whether the value sort is er than the middle value. Then it splits the array again and repeats the check.

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

What is a linear search (also known as brute-force search)?

A

In linear search computer searches from 1st item in list to last item in list, 1 by 1, until sought item found.

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

When should you use a linear search?

A

When data searched too small, or when data so frequently ammended that sorting the list is a waste of time.

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