Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Algorithms: Introduction, Peak Finding, Complexity, Lecture notes of Data Structures and Algorithms

It is a lecture note for Design of algorithms

Typology: Lecture notes

2018/2019

Uploaded on 01/04/2019

m_ali_abid
m_ali_abid 🇵🇰

1 document

1 / 30

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Introduction to the Course
Setting Targets
Peak Finding Problem
Complexity
Peak Finding Problem - Again
Computational Complexity - Again
Characterizing an Algorithm
Design and Analysis of Algorithms
(Week-1)
Malik Jahan Khan
Namal College Mianwali
Malik Jahan Khan Namal College Mianwali Design and Analysis of Algorithms (Week-1)
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e

Partial preview of the text

Download Algorithms: Introduction, Peak Finding, Complexity and more Lecture notes Data Structures and Algorithms in PDF only on Docsity!

Setting Targets Peak Finding Problem Complexity Peak Finding Problem - Again Computational Complexity - Again Characterizing an Algorithm

Design and Analysis of Algorithms

(Week-1)

Malik Jahan Khan

Namal College Mianwali

Setting Targets Peak Finding Problem Complexity Peak Finding Problem - Again Computational Complexity - Again Characterizing an Algorithm

Introduction

Course outline

Classic data structures

Efficient procedures to solve large-scale problems

What is large-scale?

History of hardware progress vs algorithms

Exercise

Peak-Finder

Benchmarking and setting targets

Disclaimer: Content provided in slides of this course has been

borrowed from different sources including Cormen’s book on

Introduction to Algorithms, Khan Academy and MIT OCW.

Setting Targets Peak Finding Problem Complexity Peak Finding Problem - Again Computational Complexity - Again Characterizing an Algorithm

Exercise - Sort given n numbers

Input

n = 10 million numbers

Compute exact physical time for both of the following scenarios

Computer A - Insertion Sort

Speed: 1 billion instructions per second

Number of instructions to execute: 2n

Setting Targets Peak Finding Problem Complexity Peak Finding Problem - Again Computational Complexity - Again Characterizing an Algorithm

Exercise - Sort given n numbers

Input

n = 10 million numbers

Compute exact physical time for both of the following scenarios

Computer A - Insertion Sort

Speed: 1 billion instructions per second

Number of instructions to execute: 2n

Computer B - Merge Sort

Speed: 10 million instructions per second

Number of instructions to execute: 50nlog (n)

Setting Targets Peak Finding Problem Complexity Peak Finding Problem - Again Computational Complexity - Again Characterizing an Algorithm

Peak Finding Problem

Given a set of numbers stored in a one-dimensional array, find one

of the peaks. We are not interested in highest peak.

This is your HW of lecture-

Setting Targets Peak Finding Problem Complexity Peak Finding Problem - Again Computational Complexity - Again Characterizing an Algorithm

Complexity [Source: www.bigocheatsheet.com]

Setting Targets Peak Finding Problem Complexity Peak Finding Problem - Again Computational Complexity - Again Characterizing an Algorithm

Peak Finding Problem

Given a set of numbers stored in a one-dimensional array, find one

of the peaks. We are not interested in highest peak.

This was your HW of lecture-

Setting Targets Peak Finding Problem Complexity Peak Finding Problem - Again Computational Complexity - Again Characterizing an Algorithm

Peak Finding Problem

Given a set of numbers stored in a one-dimensional array, find one

of the peaks. We are not interested in highest peak.

This was your HW of lecture-

How would your algorithm change in its working as well as

performance if it had to compute the highest peak? e.g. ECG

signals

Setting Targets Peak Finding Problem Complexity Peak Finding Problem - Again Computational Complexity - Again Characterizing an Algorithm

Exercise-

What is the smallest value of n such that an algorithm whose

running time is 100n

runs faster than an algorithm whose running

time is 2

n

on the same machine?

Setting Targets Peak Finding Problem Complexity Peak Finding Problem - Again Computational Complexity - Again Characterizing an Algorithm

Exercise-

For each function f (n) and time t in the following table, determine

the largest size of n of a problem that can be solved in time t,

assuming that the algorithm to solve the problem takes f (n)

microseconds.

1 sec 1 min 1 hr 1 day 1 mon 1 yr 1 cent

log (n)

n

n

nlog (n)

n

n

n

n!

Setting Targets Peak Finding Problem Complexity Peak Finding Problem - Again Computational Complexity - Again Characterizing an Algorithm

Θ− Notation

Setting Targets Peak Finding Problem Complexity Peak Finding Problem - Again Computational Complexity - Again Characterizing an Algorithm

O− Notation

Setting Targets Peak Finding Problem Complexity Peak Finding Problem - Again Computational Complexity - Again Characterizing an Algorithm

o− Notation

Is O asymptotically tight bound?

Setting Targets Peak Finding Problem Complexity Peak Finding Problem - Again Computational Complexity - Again Characterizing an Algorithm

o− Notation

Is O asymptotically tight bound? may or may not!