Section 8 Chapter 46 and 47 Flashcards

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

Linear search

A

Searching for an object in a list by checking each object in order until the desired object is found

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

Linear search complexity

A

O(n)

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

Why you would use a linear search

A

To search an unordered list

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

Time complexity of binary search

A

O(log n)

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

Time complexity of bubble sort

A

O(n^2)

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

Time complexity of merge sort

A

O(nlog n)

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

What merge sort and binary search are examples of

A

Divide and conquer

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

Space complexity

A

The amount of resources, for instance memory, that an algorithm requires

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

How to code depth first search

A

Recursion

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

How to code breadth first search

A

Just do it in a function, use a queue and when adding, check that the node is not in visited AND not in the queue

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

Application of depth first search

A

Navigating through a maze

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

Applications of breadth first search (2)

A
  • Finding the shortest path between two nodes

- Web crawlers going through links

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

Data structure associated with a depth first search

A

stack

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

Data structure associated with a breadth first search

A

queue

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

What traversal is the same as the depth first search

A

pre order

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