lecture 1 Flashcards
What is an algorithm?
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]
What is NP complete problems?
They are non polynomial problems which have no efficient algorithm to solve it. ex.Travelling salesman
What is the halting problem?
the problem of determining whether a program will finish running, or continue to run forever.
Characteristics an algorithm needs to have?
It needs to have a clear unambiguous structure and it needs to give the same result with same input.
Where does the term algorithm derive from?
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”
algorithm classification based on the problem-solving approach they use:
Iterative algorithms Direct\Indirect Recursive algorithms Divide and Conquer Dynamic Programming Algorithms Randomised Algorithms Brute Force Algorithms
Why not just use code? Why abstraction?
- More intuitive for humans than “code” language
* Focus on the problem and not on the details of the implementation
What are efficient algorithms?
Those who run in polynomial time
Abstraction:
when you focus on the problem and not it’s details
What type of recursive algorithms are there?
- 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)
Explain the divide and conquer algorithm:
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