












Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An overview of problem-solving techniques, focusing on the basic steps for solving a problem and the top-down and bottom-up approaches to algorithm design. It covers the advantages and disadvantages of each approach, the definition and fundamental characteristics of algorithms, and the importance of time and space complexity, definiteness, finiteness, and correctness in algorithm design.
Typology: Lecture notes
1 / 20
This page cannot be seen from the preview
Don't miss anything!













Basic Steps for solving a problem
4
6
14 General Problem Sub task 1 (^) Sub task 2 Sub task 3 Sub sub task 1 Sub sub task 2 Sub sub task 3^ Sub sub task 4
Advantages of Top-Down Approach
15
Disadvantages
17
An Algorithm is an ordered sequence of well-stated and effective operations that, when executed, will produce the results. 19
In designing any algorithm, some important things should be considered. These are: run-time space simplicity of algorithm input data 26
Common Approaches for Designing Algorithms Greedy algorithm: It works in steps. Selects the best available option until all options finish. It is widely used. Divide and Conquer/bottom up approach: The big problem is divided into same type of smaller problems and we design the algorithm to combine the implementation of these smaller problems for implementing the bigger problem. Randomized algorithm: The feature of random number is used instead of a fixed number. It makes it possible for different input data to be entered to give different results. 27
Criteria for judging an Algorithm It must work correctly under various conditions. (^) It must solve the problem according to the given specifications. (^) It must be clearly written following the top-down or bottom-up strategy. It must make efficient use of time and resources available. (^) It must be sufficiently documented so that anybody can understand its implementation. It must be easy to modify, if required. (^) It must not be dependent on being run on a particular type of computer. 29
31
Space Complexity is the amount computer of main memory it needs to run a program to completion. (^) The space needed by a program is the sum of the following: (^) Fixed part- Space for the code, space for simple variables, component variables, space for constants, etc. (^) Variable part- Space needed by component variables whose size depend on the particular problem instance being solved, and the stack space used by recursive procedures. 33
Time Complexity Time Complexity is the amount of computer time it needs to run a program to completion. If space (memory) is fixed for one algorithm, then only run time will be considered for obtaining the complexity of the algorithm. 34
CHARACTERISTICS OF DATA STRUCTURE Correctness − Data structure implementation should implement its interface correctly. Time Complexity − Execution time of operations of data structure must be as small as possible. Space Complexity − Memory usage of a data structure operation should be as little as possible. Definiteness - Every step of the algorithm should be clear and well defined. Finiteness - The algorithm should have finite number of steps. 36
Questions And Answers Session