10 Algorithms Flashcards

(11 cards)

1
Q

Algorithm

A

step by step structured recipe of calculations for solving a problem

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

Pseudocode

A

Commonly used to express algorithms
Resembles a high-level programming language - like Python

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

What does the speed of a search depend on?

A

Algorithm

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

What does the speed of an algorithm depend on?

A

Nature of the data
How it is stored
How many search operations we want to perform

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

Linear search

A

Simplest search
Iterate over all entries in a list/tuple/dictionary
Does not place requirements on the order of the data

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

Binary search

A

Used if we have a sorted list
Similarities to bisection

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

What are the two classic sorting algorithms

A

Bubble
Quicksort

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

Bubble sort

A

One of the simplest sorting algorithms
Iterate over values in an array, if neighbours wrong we swap them

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

What are the cons of bubble sort

A

Inefficient for large lists, but performs the task

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

Quicksort

A

“Divide and Conquer”
Recursive algorithm

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

Which one is faster: quicksort or bubble sort

A

Quicksort

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