lecture 1 Flashcards

1
Q

What is an algorithm?

A

An algorithm is a finite sequence of unambiguous instructions for solving a problem, i.e., for obtaining the required output for any legitimate input in a finite amount of time. [Levitin 2003]

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

What is NP complete problems?

A

They are non polynomial problems which have no efficient algorithm to solve it. ex.Travelling salesman

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

What is the halting problem?

A

the problem of determining whether a program will finish running, or continue to run forever.

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

Characteristics an algorithm needs to have?

A

It needs to have a clear unambiguous structure and it needs to give the same result with same input.

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

Where does the term algorithm derive from?

A

The name comes from a Persian mathematician called Al-Khwarizmi.
• His name was written as Algorithm when the book was
translated to Latin
• Today we define the word Algorithm as a “computation method”
• The formalisation of the idea started with Hilbert in the late 1920s.
• In the context of the “decision problem”

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

algorithm classification based on the problem-solving approach they use:

A
Iterative algorithms
Direct\Indirect Recursive algorithms
Divide and Conquer
Dynamic Programming Algorithms
Randomised Algorithms
Brute Force Algorithms
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Why not just use code? Why abstraction?

A
  • More intuitive for humans than “code” language

* Focus on the problem and not on the details of the implementation

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

What are efficient algorithms?

A

Those who run in polynomial time

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

Abstraction:

A

when you focus on the problem and not it’s details

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

What type of recursive algorithms are there?

A
  • Direct: when it calls it’s self
  • Indirect: when an algorithm calls another algorithm that recalls the first one (recursion is done through different functions)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Explain the divide and conquer algorithm:

A

divides the problem into 2 parts. They are solved independently and the solutions are merged ex. mergesort or the worst case of a quick sort

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