5 & 6 I'm not able to understand Pl

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

5 & 6 I'm not able to understand

Pl

 

1.Find the exact step counts (growth function) and time complexity for following algorithms -
iii.
Algorithm Add(a,b,c,m,n)
1. for i:=1to m do
2.
for i:=1 to n do
3.
i.
1. Input m and n
2. If m == n
3.
4.
5.
Print "Same"
Sum=m+n
Print Sum
6.Else Print "Not same"
iv.
1. int i, j, k = 0;
2.for (i = 1; i <= n*n; i++)
3.
4.
5.
6.
vii.
1. Set i=0
2. Repeat step 3-6 till i<=n
3.
Set J-n
4.
While J>0
i=i+1
ii.
1. Initialize i=0
for (j = 1; j <= n; j =j+1)
k = k + n/2;
J=J/2
2. For i=0 to n-1
3.
4. For i=0 to n-1
5.
Read an integer in Arr[i]
Print Arr[i]
V.
Algorithm Sum (a,n)
1 s:=0.0;
2
3
4 return s;
for i:=1 to n do
viii.
1. Set In
2. While I>1
3.
4.
5.
6.
7.
8.
9.
While J <n
I/= 2
s :=s+a[i];
K=1
While K<n
J*= 2
K+=2
ix.
c[i,j]:=a[i, j]+b[i,j];
vi.
1. sum 0
2. for i=1 to n:
3.
4.
for j = i to n:
5.print(sum)
1. {
2.
3.
4.
5.
6. }
sum += a[i][j]
void fun(int n, int arr[])
int i = 0, j = 0;
for(; i<n; ++i)
while(j<n && arr[i]<arr[j])
j+t:
Transcribed Image Text:1.Find the exact step counts (growth function) and time complexity for following algorithms - iii. Algorithm Add(a,b,c,m,n) 1. for i:=1to m do 2. for i:=1 to n do 3. i. 1. Input m and n 2. If m == n 3. 4. 5. Print "Same" Sum=m+n Print Sum 6.Else Print "Not same" iv. 1. int i, j, k = 0; 2.for (i = 1; i <= n*n; i++) 3. 4. 5. 6. vii. 1. Set i=0 2. Repeat step 3-6 till i<=n 3. Set J-n 4. While J>0 i=i+1 ii. 1. Initialize i=0 for (j = 1; j <= n; j =j+1) k = k + n/2; J=J/2 2. For i=0 to n-1 3. 4. For i=0 to n-1 5. Read an integer in Arr[i] Print Arr[i] V. Algorithm Sum (a,n) 1 s:=0.0; 2 3 4 return s; for i:=1 to n do viii. 1. Set In 2. While I>1 3. 4. 5. 6. 7. 8. 9. While J <n I/= 2 s :=s+a[i]; K=1 While K<n J*= 2 K+=2 ix. c[i,j]:=a[i, j]+b[i,j]; vi. 1. sum 0 2. for i=1 to n: 3. 4. for j = i to n: 5.print(sum) 1. { 2. 3. 4. 5. 6. } sum += a[i][j] void fun(int n, int arr[]) int i = 0, j = 0; for(; i<n; ++i) while(j<n && arr[i]<arr[j]) j+t:
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Concept of pointer parameter
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education