Algo Lecture 11 12 Design Categories 08052024 125702pm
Algo Lecture 11 12 Design Categories 08052024 125702pm
Algorithm
Dr. Iram Noreen
Classification of Algorithms
• Searching algorithms
• Sorting algorithms
• Compression algorithms
• Encoding algorithms
• Pattern matching algorithms
• Parsing algorithms
Algorithm Design Strategies
• Brute Force algorithm: It simply tries all possibilities until a satisfactory
solution is found. Does not implies any shortcuts to improve performance.
• Divide & Conquer: frequently used in searching & sorting. Works by
dividing problem in similar sub problems.
• Iterative algorithm: repetition using loops
• Dynamic Programming: Solve complex problems by breaking down into
simpler subproblems. Focused on solving each subproblem only once and
storing the results to avoids redundant computations, leading to efficient
solutions.
• Greedy algorithm: Tries for an immediate available best solution.
Algorithm Design Strategies
• Back Tracking algorithm: They use recursion to exhaust all
possibilities or until they find a solution in a large search space.
• Randomized algorithms: They use a random number at least once
during the computation for decision making.
• Optimization algorithms: May have many feasible solution and it
finds the best solution out of all possible feasible solutions.
• Branch and Bound Algorithm: It is used in combinatorial optimization
problems to systematically search for the best solution.
1. Dynamic Programming
• Dynamic programming helps to efficiently solve problems that have
overlapping subproblems and optimal substructure properties.
• The idea behind dynamic programming is to break the problem into
smaller sub-problems and save the result for future use, thus
eliminating the need to compute the result repeatedly.
• They work using momoization technique to find the best solution.
Memoization
• The term “Memoization” comes from the Latin word “memorandum”
(to remember), which is commonly shortened to “memo” in American
English, and which means “to transform the results of a function into
something to remember.”.
• In computing, memoization or memoisation is an optimization
technique used primarily to speed up computer programs by
eliminating the repetitive computation of results and returning the
cached result when the same inputs occur again.
• Memoization is actually a specific type of caching.
• It consists of recursion and caching.
Should I use tabulation or memoization?