Name three desirable properties of a good algorithm.
Algorithm should be:
These goals might not be and often are not simultanously achievable.
How is mergesort algorithm implemented?
How is quicksort algorithm implemented?
On which algorithm is shell sort based?
How is shell sort algorithm implemented?
Running time properties of mergesort algorithm?
Running time properties of quicksort algorithm?
Ways to improve default quicksort approach?
What are optimizations for the mergesort algorithm?
What are run-time properties of selection sort algorithm?
What are running time properties of insertion sort algorithm?
What are running time properties of shell sort algorithm?
Define:
heuristic
Heuristic is a technique designed for solving a problem more quickly when classic methods are too slow, or for finding an approximate solution when classic methods fail to find any exact solution. In a way, it can be considered a shortcut.
In general, every type of problem will have its own set of heuritics.
Give one example of heuristics?
An example of heuristics is using Manhattan distance heuristic function in the problem of finding the shortest path in order to decide on the next step among the list of options.
What is the difference between the algorithmic problem and an instance of an algorithmic problem.
Algorithmic problem is specified by describing the complete set of instances it must work for and produce valid solution to all of them.
Sorting is an algorithmic problem. Sorting of an array of integers is an instance of sorting problem.
This is important since recognizing the general problem in an instance is the first step to solving it.
Fundamental difference between algorithm and heuristic?
There is a fundamental difference between algorithms, which always produce correct result, and heuristics, which may usually do a good job but without providing any guarantee.
Give one example where
heuristic yields very unoptimal solution.
If points we are trying connect are lying on a flat line and we start in the middle then it will, instead of goinglinearly, it will jump towards the outside which is very unoptima.
In general, if distances between nearest neighbours become bigger and bigger towards the end of execution, it is most probably unoptimal
Which are three forms of algorithmic notation?
Three forms of algorithmic notation (going from informal to formal):
Common mistake is to use more formal structure to express not so formal level of communication. E.g. english explanation presented through pseudo code structure.
Which are two parts of algorithmic problem specification?
Two parts of algorithmic problem specification are:
What can be done with set of allowable instances in the specification of an algorithmic problem in order to make it easier to find a correct solution?
Narrowing down problems to a more simple allowable instances is a standard way to simplify reasoning about algorithms.
Example would be reasoning about a tree structure instead of full graph or single dimensional problem instead of 2-dimensional one.
What is the best way to prove one algorithm incorrectness?
The best way to prove incorrectness of an algorithm is by finding a counter-example for which algorithm is not correct.
Counter example is the case of input sequence for which correct solution exists but algorithm doesn’t find it.
Which are two important properties of counter-examples?
Two properties of a good counter-example are:
Which are good approaches in finding counter-examples?
Inductive proof steps are?