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

DAA complete notes of GIET UNIVERSITY GUNUPUR, Summaries of Design and Analysis of Algorithms

DAA complete notes of GIET UNIVERSITY GUNUPUR

Typology: Summaries

2023/2024

Available from 03/20/2025

aditya-prakash-purohit
aditya-prakash-purohit 🇮🇳

1 document

1 / 109

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Scanned by CamScanner
UNIT:1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download DAA complete notes of GIET UNIVERSITY GUNUPUR and more Summaries Design and Analysis of Algorithms in PDF only on Docsity!

  • UNIT:

Analysis of Algorithm | Set 5 (Amortized Analysis

Introduction)

Amortized Analysis is used for algorithms where an occasional operation is very slow, but most of the other operations are faster. In Amortized Analysis, we analyze a sequence of operations and guarantee a worst case average time which is lower than the worst case time of a particular expensive operation. The example data structures whose operations are analyzed using Amortized Analysis are Hash Tables, Disjoint Sets and Splay Trees. Let us consider an example of a simple hash table insertions. How do we decide table size? There is a trade-off between space and time, if we make hash-table size big, search time becomes fast, but space required becomes high. The solution to this trade-off problem is to use Dynamic Table (or Arrays). The idea is to increase size of table whenever it becomes full. Following are the steps to follow when table becomes full.

  1. Allocate memory for a larger table of size, typically twice the old table. 2) Copy the contents of old table to new table.
  2. Free the old table. If the table has space available, we simply insert new item in available space. What is the time complexity of n insertions using the above scheme? If we use simple analysis, the worst case cost of an insertion is O(n). Therefore, worst case cost of n inserts is n * O(n) which is O(n^2 ). This analysis gives an upper bound, but not a tight upper bound for n insertions as all insertions don’t take Θ(n) time.