Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
8 views
3 pages
DAA Notes Ex
Design and Analysis of Algorithm
Uploaded by
ashifkalayigar786
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save DAA notes Ex For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
8 views
3 pages
DAA Notes Ex
Design and Analysis of Algorithm
Uploaded by
ashifkalayigar786
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save DAA notes Ex For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save DAA notes Ex For Later
You are on page 1
/ 3
Search
Fullscreen
DESIGAN & ANYALYSIS OF ALGORITHM T* iteration | 2""iteration | 3" iteration afl==al2] | a2] =al3] a{]==al3] | al2}==al4] a{t]==al4] Observe the following facts from the above table: > The index variable i start from 0 and goes up to 3 as shown in dotted lines. ie, 1 €0t03 i.e. € 0 to 5-2 (n-2) ie, i € 0 ton-J > For each initial value of i, the index variable j always start from i+] and goes up to 4 as shown in the above example. ie,j €1t04 ie, i € 1 to S-1 (0-1) 1 € Oto nl > If afi] is same as afj], then duplicating item found and return 0. Algorithm Unique Element(a[],n) /Purpose: _,. Check whether the elements in a given array are distinct. /Mnputs:.“_ n- the number of items present in the table, a+», The array consisting of n elements. Output: return 0 if elements not unique (i.e., elements are duplicated) return 0 if elements unique (i.e., no elements are duplicated) for € 0 to'n-2 do /see numbers 1 the example for j € itl to n-1 do —_//see numbers 2 the example if(alil==alj]) // see numbers 3 the example return 0; Helements are not unique KLES GH BCA COLLEGE HAVERI Page 18DESIGAN & ANYALYSIS OF ALGORITHM end for end for return 1; Helements are unique The time efficiency can be calculated as shown below Analys he parameter to be considered is n which represent the size of the input. = a{j] return 0” which is the innermost for loop. Stepl: Step2: The basic operation in the statement “if afi Step3: The number of comparisons not only depends on the value of n but depends on the position of repeated elements if present. The repeated elements if not present, the number of comparisons are more. So, let us find the worst case time efficiency and best case time efficiency. Worst ease efficiency: fori € Oto n-2.do forj ©i#1 tom do iftatiIe=ati) | eo-oe 2-22 v n-2 1 Note: upper bound=n-1 Lower bound=i+1 _ Y fn) = vi j=itl i=0 5 ; fn) = D2) - Ge at i=0 22 fo)=onaasi-1+1 n-2 fn) = Yin 1-i i=0 Replacing i by 0, 1, 2, ....+4 m-2 we get = (0-1) + (0-2) + (9-3) + eee BEZEL usin a KLES GH BCA COLLEGE HAVERI Page 19
You might also like
Data Structures and Algorithm Analysis in C 4th Edition Mark A
PDF
No ratings yet
Data Structures and Algorithm Analysis in C 4th Edition Mark A
12 pages
Unit1 2
PDF
No ratings yet
Unit1 2
43 pages
Analysis of Algorithm Notes (Part-2)
PDF
No ratings yet
Analysis of Algorithm Notes (Part-2)
65 pages
Algorithm Validation 24-25-En
PDF
No ratings yet
Algorithm Validation 24-25-En
51 pages
Daa Unt 1
PDF
No ratings yet
Daa Unt 1
72 pages
Dse 2223 L32 33 34 35
PDF
No ratings yet
Dse 2223 L32 33 34 35
24 pages
Report
PDF
No ratings yet
Report
5 pages
Lecture 02 - Exercise
PDF
No ratings yet
Lecture 02 - Exercise
5 pages
Data Structures and Algorithms: (CS210/ESO207/ESO211)
PDF
No ratings yet
Data Structures and Algorithms: (CS210/ESO207/ESO211)
22 pages
Module1 PPT
PDF
No ratings yet
Module1 PPT
58 pages
Find Duplicate Elements Java
PDF
No ratings yet
Find Duplicate Elements Java
3 pages
Unit-1 DAA - Notes
PDF
No ratings yet
Unit-1 DAA - Notes
25 pages
Algorithm Assignment
PDF
No ratings yet
Algorithm Assignment
15 pages
Tut 5 Solution
PDF
No ratings yet
Tut 5 Solution
1 page
Chapter 1 - Algorithm Analysis - 2
PDF
No ratings yet
Chapter 1 - Algorithm Analysis - 2
29 pages
Lecture - 09 - Recurrence
PDF
No ratings yet
Lecture - 09 - Recurrence
31 pages
Lecture 01 - Exercise
PDF
No ratings yet
Lecture 01 - Exercise
5 pages
ADA Theory1
PDF
No ratings yet
ADA Theory1
4 pages
1.7 Mathematical Analysis of Non Recursive Algorithm
PDF
No ratings yet
1.7 Mathematical Analysis of Non Recursive Algorithm
7 pages
SE Sem IV AoA Lab Experiment 1 202425
PDF
No ratings yet
SE Sem IV AoA Lab Experiment 1 202425
5 pages
Lab2 24 - 07 - 2024
PDF
No ratings yet
Lab2 24 - 07 - 2024
10 pages
Mathematical Analysis of Nonrecursive Algorithms
PDF
No ratings yet
Mathematical Analysis of Nonrecursive Algorithms
13 pages
Lec5 - 6 - 2019
PDF
No ratings yet
Lec5 - 6 - 2019
81 pages
5-Stages of Algorithm Development & Time Complexity Analysis-05-01-2024
PDF
No ratings yet
5-Stages of Algorithm Development & Time Complexity Analysis-05-01-2024
31 pages
Lecture 03
PDF
No ratings yet
Lecture 03
37 pages
2-Analysis of Algorithm
PDF
No ratings yet
2-Analysis of Algorithm
14 pages
C++ Programming Practice With Solution
PDF
No ratings yet
C++ Programming Practice With Solution
3 pages
Cse 551 - Foa - 2
PDF
No ratings yet
Cse 551 - Foa - 2
8 pages
Mathematical Analysis of Nonrecursive Function
PDF
No ratings yet
Mathematical Analysis of Nonrecursive Function
14 pages
DAA PPT DAA PPT by Dr. Preeti Bailke
PDF
No ratings yet
DAA PPT DAA PPT by Dr. Preeti Bailke
21 pages
Tutorial1 Solutions
PDF
No ratings yet
Tutorial1 Solutions
4 pages
Algorithm
PDF
No ratings yet
Algorithm
40 pages
WINSEM2024-25 BCSE204L TH VL2024250501496 2024-12-14 Reference-Material-I
PDF
No ratings yet
WINSEM2024-25 BCSE204L TH VL2024250501496 2024-12-14 Reference-Material-I
32 pages
01 - Report On Assigned Problem
PDF
No ratings yet
01 - Report On Assigned Problem
9 pages
All Questions
PDF
No ratings yet
All Questions
6 pages
Solucio Parcial 2018 2019 Q2.eng
PDF
No ratings yet
Solucio Parcial 2018 2019 Q2.eng
3 pages
Lecture Chapter 2 Part 2
PDF
No ratings yet
Lecture Chapter 2 Part 2
56 pages
DAA Solutions
PDF
No ratings yet
DAA Solutions
7 pages
Unique Algorithm
PDF
No ratings yet
Unique Algorithm
6 pages
RecursiveAlgo RunningTime
PDF
No ratings yet
RecursiveAlgo RunningTime
36 pages
DAA Unit 1 Notes
PDF
No ratings yet
DAA Unit 1 Notes
34 pages
CPS 305 - Lecture Note and Course Outline
PDF
No ratings yet
CPS 305 - Lecture Note and Course Outline
26 pages
Daa Vtu Module Ii
PDF
No ratings yet
Daa Vtu Module Ii
86 pages
2022-12 Questions
PDF
No ratings yet
2022-12 Questions
11 pages
Final Exam (Solution With Scale)
PDF
No ratings yet
Final Exam (Solution With Scale)
4 pages
Headsoln Master Method
PDF
No ratings yet
Headsoln Master Method
6 pages
ADA Unit-3
PDF
No ratings yet
ADA Unit-3
45 pages
CS251 HW1
PDF
No ratings yet
CS251 HW1
4 pages
Algorithm:: Unit-I
PDF
No ratings yet
Algorithm:: Unit-I
9 pages
What Is An Algorithm?: (And How Do We Analyze One?)
PDF
No ratings yet
What Is An Algorithm?: (And How Do We Analyze One?)
29 pages
2IL50 Data Structures: 2018-19 Q3 Lecture 2: Analysis of Algorithms
PDF
No ratings yet
2IL50 Data Structures: 2018-19 Q3 Lecture 2: Analysis of Algorithms
39 pages
CSC323 Sp2016 QB Module 1 Efficiency of Algorithms
PDF
No ratings yet
CSC323 Sp2016 QB Module 1 Efficiency of Algorithms
14 pages
1-Divide and Conquer Algorithms
PDF
No ratings yet
1-Divide and Conquer Algorithms
99 pages
Guide To Divide-and-Conquer: A Sample Problem: Finding The Non-Duplicate
PDF
No ratings yet
Guide To Divide-and-Conquer: A Sample Problem: Finding The Non-Duplicate
4 pages
HW1 SolutionKey
PDF
No ratings yet
HW1 SolutionKey
8 pages
Unit 3 For ADA
PDF
No ratings yet
Unit 3 For ADA
21 pages