You are on page 1of 15

Data structures and Algorithms

Module 1
Algorithm Analysis
Dr Athira K
SCOPE
Foundation of Algorithms

❑What are algorithms?


❑ Why is the study of algorithms worthwhile?
❑What is the role of algorithms relative to
other technologies used in computers?
Algorithm

• Algorithm is any well-defined computational procedure that takes some value,


or set of values, as input and produces some value, or set of values, as output.
• An algorithm also considered as a tool for solving a well-specified
computational problem
• Which algorithm is best for a given application? -Sorting problem
• the number of items to be sorted
• extent to which the items are already somewhat sorted
• possible restrictions on the item values
• the architecture of the computer
• kind of storage devices to be used: main memory, disks
• Importance of correctness
Practical applications of algorithms?
• The Human Genome Project has made great progress toward the
goals of identifying all the 100,000 genes in human DNA, determining
the sequences of the 3 billion chemical base pairs that make up
human DNA, storing this information in databases, and developing
tools for data analysis. Sophisticated algorithms can save in time, both
human and machine, and in money, as more information can be
extracted from laboratory techniques.
• Clever algorithms, manage internet sites and manipulate large volume
of data. Use of algorithms include finding good routes on which the
data will travel, using a search engine to quickly find pages on which
particular information resides and so on.
Practical applications of algorithms?
• The core technologies used in electronic commerce include public-key
cryptography and digital signatures, which are based on numerical
algorithms and number theory.
• How do we choose which of all possible road routes is the shortest?
Here, we model the road map as a graph and find the shortest path
from one vertex to another using shortest path algorithms.
• We are given two ordered sequences of symbols, X (x 1; x2;…..;xmi) and
Y (y1; y2;….;yni), and we wish to find a longest common subsequence
of X and Y. ----Similarity of gene sequences.
Algorithm as a technology
• Algorithms are at the core of most technologies used in contemporary
computers.
➢Suppose computers were infinitely fast and computer memory was free?

• Computing time is a bounded resource, and so is space in memory.


• Use these resources wisely, and algorithms that are efficient in terms of
time or space will help to do so.
• Total system performance depends on choosing efficient algorithms as
much as on choosing fast hardware.
• Algorithms Analysis does not answer the question "How much of a
resource is consumed to process n pieces of data"
• The real question it answers is "How much more of the same
resource will it consume to process n+1 pieces of data".
• What we really care about is the growth rate of resource
consumption with respect to the data size
• Algorithms analysis is all about understanding growth rates
• We describe the resource growth rate of a piece of code in terms of a
function
Constant Growth Rate
• A constant resource need is one where the resource need does not
grow.
• That is processing 1 piece of data takes the same amount of resource
as processing 1 million pieces of data.
• The graph of such a growth rate looks like a horizontal line

You might also like