Algorithms and Complexity: Basics of Algorithm Analysis, Summaries of Computer Science

A fundamental introduction to the analysis of algorithms, a crucial aspect of computer science. It explores the importance of analyzing algorithm performance in terms of time and space efficiency, emphasizing the concept of scalability. The document delves into the concept of order of growth, illustrating how to determine the efficiency of algorithms based on their growth rate. It also introduces asymptotic analysis, a method for evaluating algorithm performance in relation to input size, highlighting the differences between linear and logarithmic growth.

Typology: Summaries

2024/2025

Uploaded on 01/26/2025

raulinejane-uriarte
raulinejane-uriarte 🇭🇰

2 documents

1 / 9

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ALGORITHMS
AND
COMPLEXITY
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Algorithms and Complexity: Basics of Algorithm Analysis and more Summaries Computer Science in PDF only on Docsity!

ALGORITHMS

AND

COMPLEXITY

TOPICS

• Basics on Analysis of Algorithms

• Asymptotic Notations

• Analysis Examples

BASICS ON ANALYSIS OF

ALGORITHMS

  • (^) Analysis of Algorithms is a fundamental aspect of

computer science that involves evaluating performance of

algorithms and programs. Efficiency is measured in terms

of time and space.

Why is Analysis of Algorithm important? • (^) So performance is like currency through which we can buy all the above things. Another reason for studying performance is performance == scale.

  • (^) Algorithm analysis is an important part of computational complexity theory, which provides theoretical estimation for the required resources of an algorithm to solve a specific computational problem. Analysis of algorithms is the determination of the amount of time and space resources required to execute it.

BASICS ON ANALYSIS OF

ALGORITHMS

  • (^) Analysis of Algorithms is a fundamental aspect of

computer science that involves evaluating performance of

algorithms and programs. Efficiency is measured in terms

of time and space.

Why is Analysis of Algorithm important? • (^) So performance is like currency through which we can buy all the above things. Another reason for studying performance is performance == scale.

  • (^) Algorithm analysis is an important part of computational complexity theory, which provides theoretical estimation for the required resources of an algorithm to solve a specific computational problem. Analysis of algorithms is the determination of the amount of time and space resources required to execute it.

Order of Growth

  • (^) Let f(n) and g(n) be the time taken by two algorithms where n >=

9 and f(n) and g(n) are also greater than equal to 0. A function f(n)

is said to be growing faster than g(n) if g(n)/f(n) for n tends to

infinity is 0 (or f(n)/g(n) for n tends to infinity is infinity).

Example 1: f(n) = 1000, g(n) = n + 1 For n > 999, g(n) would always be greater than f(n) because order of growth of g(n) is more than f(n). Example 2 : f( n ) = 4n^2 , g(n) = 2n + 2000 f(n) has higher order of growth as it grows quadratically in terms of input size.

Order of Growth

  • (^) How do we Quickly find order of Growth? When n >= 0, f(n) >= 0 and g(n) >= 0, we can use the below steps. - (^) Ignore the order terms. - (^) Ignore the constants Example 1 : 4n 2 + 3n + 100 After ignoring lower order terms, we get 4n 2 After ignoring constants, we get n^2 Hence order of growth is n 2 Example 1 : 100 n Log n + 3n + 100 Log n + 2 After ignoring lower order terms, we get 100 n Log n After ignoring constants, we get n Log n Hence order of growth is n Log n
  • (^) How do we compare two order of growths? c < Log Log n < Log n < n1/3^ < n1/2^ < n < n Log n < n^2 < n^2 Log n < n^3 < n^4 < 2n^ < nn Here c is a constant