23
Summer training on Programming Methodology with Logic and Algorithm Designing

Summer training on Programming Methodology with Logic and Algorithm Designing

Embed Size (px)

Citation preview

Page 1: Summer training on Programming Methodology with Logic and Algorithm Designing

Summer training on

Programming Methodology with Logic and

Algorithm Designing

Page 2: Summer training on Programming Methodology with Logic and Algorithm Designing

Informal definition of an algorithm used in a computer

Page 3: Summer training on Programming Methodology with Logic and Algorithm Designing

3

History of Algorithm

An algorithm, named for the ninth century Persian Mathematician al-Khowarizmi, is simply a set of rules for carrying out some calculations, either by hand or, more usually, on a machine.

Informally, an algorithm is any well defined computational procedure that takes some value or set of values as output.

Page 4: Summer training on Programming Methodology with Logic and Algorithm Designing

30’s: Mathematical notion of algorithms

Church, Turing, Post

recursive functions, Λ-calculus, Turing-machines

Church, Gödel

algorithmic and logical undecidability

Page 5: Summer training on Programming Methodology with Logic and Algorithm Designing

50’s, 60’s: Computers

the significance of running time

simple and complex problems

sorting

searching

arithmetic

Travelling Salesman

matching

network flows

factoring

Page 6: Summer training on Programming Methodology with Logic and Algorithm Designing

late 60’s-80’s: Complexity theory

P=NP?

Time, space, information complexity

Polynomial hierarchy

Nondeterminism, good characteriztion, completeness

Randomization, parallelism

Classification of many real-life problems into P vs. NP-complete

Page 7: Summer training on Programming Methodology with Logic and Algorithm Designing

90’s: Increasing sophistication upper and lower bounds on complexity

algorithms negative results

factoringvolume computationsemidefinite optimization

topologyalgebraic geometrycoding theory

Page 8: Summer training on Programming Methodology with Logic and Algorithm Designing

Higlights of the 90’s:

Approximation algorithms

positive and negative results

Probabilistic algorithms

Markov chains, high concentration, nibble methods, phase transitions

Pseudorandom number generators

from art to science: theory and constructions

Page 9: Summer training on Programming Methodology with Logic and Algorithm Designing

Randomized algorithms (making coin flips):

Algorithms and probability

Algorithms with stochastic input:

difficult to analyze

even more difficult to analyze

important applications (primality testing, integration, optimization, volume computation, simulation)

even more important applications

Difficulty: after a few iterations, complicated functions of the original random variables arise.

Page 10: Summer training on Programming Methodology with Logic and Algorithm Designing

In our opinion, the notion of algorithm cannot be rigorously defined in full generality, at least for the time being. The reason is that the notion is expanding.

Andreas Blass suggested a better analogy: algorithms to numbers.

Many kinds of numbers have been introduced throughout history: positive integers, natural numbers, rationals, reals, complex numbers, quaternions, infinite cardinals, infinite ordinals, etc.

Similarly many kinds of algorithms have been introduced.

Classical sequential algorithms, in use from antiquity, we have now parallel, interactive, distributed, real-time, analog, hybrid, quantum, etc. Algorithms.

The only algorithms in use from antiquity to the 1950s.

“Algorithms compute in steps of bounded complexity”, wrote Andrei Kol mogorov in 1953.

Page 11: Summer training on Programming Methodology with Logic and Algorithm Designing

From 3000 BC to 2000 AD

Page 12: Summer training on Programming Methodology with Logic and Algorithm Designing

Perspective

Algorithms we can find everywhere. They have been developed to easy our daily life. It began with calculating algorithms and is today going to artificial intelligence and molecular biology. Google is one of the actual product of this development, knowledge based databases and neuronal networks will lead to the next...

Page 13: Summer training on Programming Methodology with Logic and Algorithm Designing

Another Defination of Algorithm

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

Page 14: Summer training on Programming Methodology with Logic and Algorithm Designing

The word "algorithm" has an interesting history

algorism (noun), algorithm (noun), algorist (noun): these words come from the now-quite-distorted name of a person, Ja'far Mohammed Ben Musa, who was known as al-Khowarazmi, meaning "the man from Khwarazm."

Page 15: Summer training on Programming Methodology with Logic and Algorithm Designing

Any use or manipulation of Arabic numerals - especially a pattern used to add, subtract, multiply, etc. - was known as an algorism.

The current form algorithm exhibits what the Oxford English Dictionary calls a "pseudo-etymological perversion": it got confused with the word arithmetic.

Current dictionaries still list the older form algorism in the sense of "the decimal or Arabic system of numeration."

A calendar is nothing but an algorithmic way of assigning - in this case Hebrew – dates.

Page 16: Summer training on Programming Methodology with Logic and Algorithm Designing

What Kind of Problems solved by Algorithms?

Anything solved by a computer is done using an algorithm.

The halting problem is a famous problem that *cannot* be solved with an algorithm.

“algorithmic problem-solving”; this means exploiting what has been learned from the experience of developing computer software over the last 50 years that has helped us to hone our problem-solving skills.

Page 17: Summer training on Programming Methodology with Logic and Algorithm Designing

Algorithms are the end-product of the problem-solving process and it is imperative that they are made explicit and are carefully studied.

Correct-by-construction is a systematic way of designing algorithms using the specification as a blueprint; it is a pre-hoc design process quite different from the post-hoc process used to “debug” computer software

Page 18: Summer training on Programming Methodology with Logic and Algorithm Designing

Roland Backhouse’s book on Algorithmic Problem Solving introduces the principles underlying correct-by-construction design techniques.

Problem solving is not easy. Don’t confuse problem solving with the verification of existing solutions; construction is much harder than verification!

Page 19: Summer training on Programming Methodology with Logic and Algorithm Designing

If the problem is that of computations, being "unambiguous" usually means that a human of average intelligence must be able (if only in principle) to follow the instructions with pencil and paper.

A discerning robot must be able to perform the job as well this links the idea of algorithm to programming.

However, quite often, the concept of algorithm is thought to be distinct from that of program.

Page 20: Summer training on Programming Methodology with Logic and Algorithm Designing

Problems Listing

Sorting: Sorting provides a good example of an algorithm that is very frequently used by computer scientists.

Shortest Path: The most real worl problems as networking, traffic problem or hacking.

Approximate algorithms: NP-hard problems, even the most advanced algorithm, with the most advanced heuristics, on the fastest computers which is too slow.

Page 21: Summer training on Programming Methodology with Logic and Algorithm Designing

Since the fastest known algorithm for solving this problem is too slow – and many believe this will always be true – programmers look for sufficiently fast algorithms that give good, but not optimal solutions.

Random Algorithms: OS desining, interrupt handling, password cracking, cryptography, etc.

Compression: Data compression, cache memory, mailing, sharing, etc.

Maximum Flow: The US wanted to know how quickly the Soviet Union could get supplies through its rail network to its satellite states in Eastern Europe.

Page 22: Summer training on Programming Methodology with Logic and Algorithm Designing

Pattern matching: Sequence comparison, anti-virus development, hacking, DNA problems and plagiarism detection, Bioinformatics, medical,etc.

Circuit diagrams. Compilation (Directed Acyclic graphs) Maps. Very compact as graphs. Network flow problems. Decision trees for expert systems. Dynamic Problems

Page 23: Summer training on Programming Methodology with Logic and Algorithm Designing

Greedy algortihm Branch and Bound algorithms Divide and Conquer algorithms Recursion algorithms Backtracking algorithms And many more......