0% found this document useful (0 votes)
21 views9 pages

Introduction To Algorithms Lec 4

An algorithm is a sequence of unambiguous instructions to solve a problem and obtain an output for any input in a finite amount of time. Some well-known computational problems addressed by algorithms include sorting, searching, finding shortest paths in graphs, minimum spanning trees, the traveling salesman problem, and the knapsack problem. Algorithm design strategies include brute force, divide and conquer, greedy approaches, dynamic programming, and backtracking. Algorithms are analyzed based on their correctness, time efficiency, and space efficiency.

Uploaded by

adihashmi27
Copyright
© © All Rights Reserved
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% found this document useful (0 votes)
21 views9 pages

Introduction To Algorithms Lec 4

An algorithm is a sequence of unambiguous instructions to solve a problem and obtain an output for any input in a finite amount of time. Some well-known computational problems addressed by algorithms include sorting, searching, finding shortest paths in graphs, minimum spanning trees, the traveling salesman problem, and the knapsack problem. Algorithm design strategies include brute force, divide and conquer, greedy approaches, dynamic programming, and backtracking. Algorithms are analyzed based on their correctness, time efficiency, and space efficiency.

Uploaded by

adihashmi27
Copyright
© © All Rights Reserved
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/ 9

Algorithms

Introduction to Algorithms
WHAT IS AN 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.
ALGORITHM Behavior

problem

algorith
m

input “computer” output

Algorithmic solution
SOME WELL-KNOWN
COMPUTATIONAL PROBLEMS
 Sorting
 A Sorting Algorithm is used to rearrange a given array or list elements according to a comparison operator on the

elements.

 Searching
 Searching Algorithms are designed to check for an element or retrieve an element from any data structure where it is

stored. Based on the type of search operation, 1. Sequential 2. Interval

 Shortest paths in a graph


 In graph theory, the shortest path problem is the problem of finding a path between two vertices (or nodes) in a

graph such that the sum of the weights of its constituent edges is minimized.

 Minimum spanning tree


 A minimum spanning tree or minimum weight spanning tree is a subset of the edges of a connected, edge-weighted

undirected graph that connects all the vertices together, without any cycles and with the minimum possible total

edge weight
SOME WELL-KNOWN
COMPUTATIONAL PROBLEMS
 Traveling salesman problem
 Given a set of cities and distance between every pair of cities, the problem is to find the shortest possible route

that visits every city exactly once and returns to the starting point

 Knapsack problem
 The knapsack problem is a problem in combinatorial optimization: Given a set of items, each with a weight and

a value, determine the number of each item to include in a collection so that the total weight is less than or

equal to a given limit and the total value is as large as possible.

 Chess

 Towers of Hanoi
ALGORITHM DESIGN
STRATEGIES
 Brute force
 Divide and conquer
 Decrease and conquer
 Transform and conquer
 Greedy approach
 Dynamic programming
 Backtracking and Branch and bound
 Space and time tradeoffs
ANALYSIS OF ALGORITHMS

 How good is the algorithm?


 Correctness
 Time efficiency
 Space efficiency
 Does there exist a better algorithm?
 Lower bounds
 Optimality
WHAT IS AN ALGORITHM?
 Recipe, process, method, technique, procedure,
routine,… with following requirements:
1. Finiteness
terminates after a finite number of steps
2. Definiteness
rigorously and unambiguously specified
3. Input
valid inputs are clearly specified
4. Output
can be proved to produce the correct
output given a valid input
5. Effectiveness
steps are sufficiently simple and basic
WHY STUDY ALGORITHMS

 Theoretical importance
 The core of computer
science

 Practical importance
 A practitioner’s toolkit of known algorithms
 Framework for designing and analyzing algorithms
for new problems

You might also like