0% found this document useful (0 votes)
99 views8 pages

Lecture-1-2: Faculty: Aditya Dayal Tyagi Department of Computer Science & Engineering

The document provides an introduction to algorithms, including definitions of an algorithm, its characteristics, and analysis of algorithm performance. It discusses how algorithm analysis evaluates the time and space complexity of algorithms, with time complexity measuring the number of steps required and space complexity measuring the memory required. The analysis seeks upper bounds on running time and commonly uses Big-O notation to characterize efficiency based on problem size. Worst-case analysis evaluates maximum running time on any input.

Uploaded by

Aditya Tyagi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
99 views8 pages

Lecture-1-2: Faculty: Aditya Dayal Tyagi Department of Computer Science & Engineering

The document provides an introduction to algorithms, including definitions of an algorithm, its characteristics, and analysis of algorithm performance. It discusses how algorithm analysis evaluates the time and space complexity of algorithms, with time complexity measuring the number of steps required and space complexity measuring the memory required. The analysis seeks upper bounds on running time and commonly uses Big-O notation to characterize efficiency based on problem size. Worst-case analysis evaluates maximum running time on any input.

Uploaded by

Aditya Tyagi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 8

Lecture-1-2

Introduction to Algorithm

Faculty: Aditya Dayal Tyagi


Department of Computer Science &
Engineering

25 July 2019
Design and Analysis of Algorithms
Algorithm:
A finite set of well-defined instructions arranged in a
specific sequence to solve a computationally feasible
problem.
Characteristics of Algorithm-
1. Input-The range of input should be specified.
2. Output-Expected output should be specified.
3. Definiteness/ Effectiveness-Each instruction must
be clear and unambiguous.
4. Finiteness-Algorithm must terminate after a finite
number of steps.
5. Feasibility-It must be possible to perform each
instruction.
Design and Analysis of Algorithm
• Algorithmic is a branch of computer science
that consist of designing and analyzing
computer algorithm.
• 1. The Design refers to-
(i) The description of algorithm at an abstract
level by means of a pseudo language and-
(ii) Proof of correctness that is, the algorithm
solves the given problem in all cases.
2. The Analysis deals with the performance
evaluation(Complexity Analysis)
Algorithm Performance/Complexity of
Algorithm/Efficiency of Algorithm/
Analysis of Algorithm
• Two important ways to characterize the
efficiency of an algorithm are its Time
Complexity & Space Complexity.
• Time complexity
– How much no of steps is required to execute
an Algorithm
• Space complexity
– How much space is required to execute an
Algorithm
Time Complexity

• The running time depends on the input: an


already sorted sequence is easier to sort.
• Major Simplifying Convention:
Parameterize the running time by the size of
the input, since short sequences are easier to
sort than long ones.
TA(n) = time of A on length n inputs
• Generally, we seek upper bounds on the
running time, to have a guarantee of
performance.
Factors that Determine
Running time of a Program

• problem size: n
• basic algorithm / actual processing
• memory access speed
• CPU/processor speed
• # of processors?
• compiler/linker optimization?
Time Complexity

• measure of algorithm efficiency


• has a big impact on running time.
• Big-O notation is used.
• To deal with n items, time complexity can
be O(1), O(log n), O(n), O(n log n), O(n2),
O(n3), O(2n), even O(nn).
Kinds of analysis
Worst-case: (usually)
• T(n) = maximum time of algorithm
on any input of size n.
Average-case: (sometimes)
• T(n) = expected time of algorithm
over all inputs of size n.
• Need assumption of statistical
distribution of inputs.
Best-case: (NEVER)
• Cheat with a slow algorithm that
works fast on some input.

You might also like