An algorithm is a finite sequence of steps to solve a problem, producing an output from given inputs. Key properties include termination, determinism, and independence from programming languages. The document outlines steps for constructing algorithms, including problem definition, design, verification, coding, and analysis of time and space complexity.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
16 views8 pages
4 Semester, CSE
An algorithm is a finite sequence of steps to solve a problem, producing an output from given inputs. Key properties include termination, determinism, and independence from programming languages. The document outlines steps for constructing algorithms, including problem definition, design, verification, coding, and analysis of time and space complexity.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8
DAA
4th semester ,CSE
Algorithms • Definition – It is a combination of sequence of finite steps to solve a particular problem. • For example: • Subtraction of 2 number : Sub() { Take 2 numbers (a,b); C = a –b ; Return (c); } • Algorithm is the superset of all programming languages. • It may take any i/p or not but definitely gives an o/p as a result. Properties
• It should terminate after finite time.
• It should produce at least one o/p. • It is independent of all programming languages. • Every statement in the algorithm should be deterministic. (a+b)-c => deterministic , a+b-c => ambiguous. Steps to construct algorithms • Problem definition – knowing the problem , • For every possible i/p you must know its o/p(mapping) . • i/p - o/p A------------------b C------------------d | | Y-----------------z • Design algorithm : Algorithm Subject has many algorithms, You have to select one suitable algorithm for your problem. • Any type of algorithms we can generate or we can build or we can construct. • divide and concur method. • greedy algorithm. • dynamic programming. • Backtracking. • branch and bound. • Flow chart: Diagrammatic representation of algorithm by sowing flow of controls in a sequence (Systematic manner. ) • Verification and testing: For every input our output must be correct or not. • Coding and implementing: selection of language in which coder is suitable for coding Either may be C, C, Java, etc. Manually . • Analysis. How much space and how much time it is taking for execution of algorithms . • To analyze the algorithm. There are two aspects that is, space and time space. Shows that how much memory it will take to store the particular algorithm and time reference the cpu time. It will take to execute the algorithm and get some output. • So program saved in hard disk and it is running in the memory main memory so. Because of that reading instruction from HDD takes more time. Rather than the cache memory. The cost of our algorithm is more if it is in the hard disk and peak is measured if the data is in the cache memory .