Documente Academic
Documente Profesional
Documente Cultură
The sorting software module has to sort a few million records sometime between 2 to 4am in the night.
From the above records, you have region-wise, sales-person-wise, product-wise, total revenues!
Algorithms
What is an algorithm?
A step-by-step procedure, which is unambiguous and machine executable Solves a given problem correctly and guarantees to give the right answer(s) in finite time (in other words, an algorithm is a provably correct method to solve the given problem) Finite in length Takes a finite number of valid input(s) of finite length, takes a finite time to solve the given problem for the given inputs and produces a finite number of correct output(s) of finite length (and produces an appropriate error message for invalid input(s)) Initially described in pseudo-English but can be programmed using one of the formal computer programming languages on any computing platform
Algorithms
An example to illustrate
Suppose the goal is to find the solution (values of x, y & z), if any, of the following system of linear equations:
Algorithms
An example to illustrate
In the example, x is eliminated from L2 by adding x is then eliminated from L3 by adding L1 to L3. The result is:
to L2.
Algorithms
An example to illustrate
Now y is eliminated from L3 by adding 4L2 to L3: The result is:
Then, z can be substituted into L2, which can then be solved to obtain Next, z and y can be substituted into L1, which can be solved to obtain
Algorithms
Why to design and develop algorithms?
1. A mechanism to solve a problem (e.g. Gauss Elimination Method is a mechanism to solve Linear Simultaneous Equations) 2. A mechanism to automate the process of solving a given problem repeatedly on a computing platform on different sets of inputs
Algorithms
Why to analyze algorithms?
1. Any correct solution to a given problem is NOT the end-of research endeavor 2. The time and memory-space taken by an algorithm are of critical importance to both the computer scientists and IT industry professionals 3. If there are more than one algorithm to solve a given problem, these algorithms can be compared along the dimensions of time and memory-space complexities 4. It is at times possible to find a better algorithm to a given problem which takes less time and consumes less memoryspace; sometimes, there is a trade-off and one can choose the best-fit algorithm for a given situation
Algorithms
Why to analyze algorithms?
1. The complexity of an algorithm is typically analyzed along the dimensions of 1. Time taken 2. Memory-space taken to solve a typical average type instance / the worst-case instance / the best-case instance of the given problem 2. The time or memory-space taken by a digital computer to solve an instance of the problem (a given set of inputs define an instance of the problem) using a particular algorithm does NOT offer any definitive views on the complexity of an algorithm 3. A theory & notation on the Order of Complexity was invented as a means to compare algorithms
Algorithms
Design and selection of Data Structures has a major impact on the Complexity of an algorithm
Assignments of Class # 1
1. Send a write-up on who invented calculus and why it was invented? 2. Write a Computer Program that reads three integers as input and determines whether these three integers constitute the sides of a triangle or not. 3. Who invented Quick-Sort algorithm? Send your C language based program to my email-id: ravipgorthi@gmail.com