Searching Algorithms Flashcards

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

What is a linear sort?

A

When the items are not in any particular order, the data items have to be searched one by one until the required one is found or the end of the list is reached

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

What is the time complexity of the linear search, in Big-O notation?

A

O(n)

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

What is the precondition of a binary search?

A

The item in the list must be sorted

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

How does a binary search work?

A

It repeatedly divides the portion of the data list that could contain the require data item, this is continued until there is only one item in the list

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

What is the time complexity of a binary search, in terms of Big O notation?

A

O(log n)

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

What is the binary search strategy?

A

Divide and conquer

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

How is a binary tree search done?

A

Similar to a binary tree, but instead of removing half of the list ,it eliminates a subtree each time its root is examined

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

What is the time complexity if binary tree search, in terms of Big-O notation?

A

Same as a binary search O(log n)

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