Algorithms 2.3 Flashcards

1
Q

What is time complexity?

A

The amount of time required to solve a problem

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

What is space complexity?

A

The amount of storage space an algorithm takes up

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

What is the time complexity for a linear search?

A

O(n)

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

What is the time complexity for a binary search?

A

o(logn)

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

What is the time complexity for bubble sort?

A

o(n^2)

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

What is the time complexity for insertion sort?

A

o(n^2)

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

What is the time complexity of a merge sort algorithm?

A

O(nlogn)

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

What is the time complexity of a quicksort algorithm?

A

O(nlogn)

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

What is a condition of a binary search tree?

A

All data must be storted(ordered)

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

What is Dijsktra’s algorithm?

A

A shortest path algorithm used to find the shortest distance between two nodes in a network

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

How is Dijkstra’s algorithm implemented?

A

Use a priority queue which has the shortest lengths at the begining

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

What is the A* algorithm?

A

A pathfinding algorithm which has two costs; actual cost and aproximated cost

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

Why are heuristics used in the A* algorithm?

A

To calculate an approixmate cost from node x to the destination node. It aims to find the shortest path

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

State a disadvantage of the A* algorithm

A

It takes a large amount of space to store all possible paths and a lot of time to find them

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

State a disadvantage of the Dijkstra algorithm

A

It does a blind search there by consuming a lot of time waste of necessary resources

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