SlideShare a Scribd company logo
1 of 6
Royal Commission for Jubail and Yanbu
Jubail University College
Computer Science & Engineering Department
Cover Page
FX-ACA-002
Issue 0 Rev. 1
January 2, 2014
i
Exam Type: Assign 1(LT) Semester: 391
Course Code CS 313 Course Title Design and analysis of
Algorithms
Submission Date WEEK 7(Sunday)
PART I TO BE FILLED BY THE STUDENT
STUDENT’S
NAME
ID. No.
Course Section
TO BE FILLED BY THE CONCERNED DEPARTMENT
PART II 1st Marker 2nd Marker
Question
No.
Max
Marks
Actual
Marks
Comments/Remarks
Actual
Marks
Comments/Remarks
1 20
2 3
3 3
4 4
Total 30
Name: Dr. Ruchi Tuli Name:
Signature: Signature:
1. Calculate the time and space complexity(total amount of
space required) of the
following: (20 Marks)
a. Algorithm sum(a[ ], n) [4 Marks]
sum =0
for(i=0 to n)
sum = sum + a[i]
return sum
b. Algorithm A1() [3 Marks]
int i
for(i= 1 to n)
print(i)
c. Algorithm A3() [4 Marks]
int i, j
for(i= 1 to n)
for(j= 1 to n)
print(“hello”)
d. int sum(int x, int y, int z) { [2 Marks]
int w = x + y + z;
return w;
}
Instructions :-
sion. Only hard copy submission
e. void Add(int a[ ], int b[ ], int c[ ], int n) { [4 Marks]
for (int i = 0; i < n; ++i) {
c[i] = a[i] + b[j]
}
}
f. void Multiply(int a[ ], int b[ ], int c[ ][ ], int n) { [3
Marks]
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
c[i] = a[i] + b[j];
}}}
2. Show that 3n3+2n2+7n+9 is O(n3) [3 Marks]
3. Show that n! is O(nn) [3 Marks]
4. Prove that n10 is O(2n ) [4 Marks]

More Related Content

More from daniely50

rocess, Physical Distribution, and Logistics Consulting Services.docx
rocess, Physical Distribution, and Logistics Consulting Services.docxrocess, Physical Distribution, and Logistics Consulting Services.docx
rocess, Physical Distribution, and Logistics Consulting Services.docx
daniely50
 
Rock Crystal         Story by A. Stifter Albert Bier.docx
Rock Crystal         Story by A. Stifter Albert Bier.docxRock Crystal         Story by A. Stifter Albert Bier.docx
Rock Crystal         Story by A. Stifter Albert Bier.docx
daniely50
 
Rogers Communications Historical BackgroundOne of the Largest an.docx
Rogers Communications Historical BackgroundOne of the Largest an.docxRogers Communications Historical BackgroundOne of the Largest an.docx
Rogers Communications Historical BackgroundOne of the Largest an.docx
daniely50
 
ROBERT M. BOHMUniversity of Central FloridaandBRENDA.docx
ROBERT M. BOHMUniversity of Central FloridaandBRENDA.docxROBERT M. BOHMUniversity of Central FloridaandBRENDA.docx
ROBERT M. BOHMUniversity of Central FloridaandBRENDA.docx
daniely50
 
RobertA multicultural city means a city whose members have a d.docx
RobertA multicultural city means a city whose members have a d.docxRobertA multicultural city means a city whose members have a d.docx
RobertA multicultural city means a city whose members have a d.docx
daniely50
 
Robin went to work for Titans, Inc., a major banking house, as a sec.docx
Robin went to work for Titans, Inc., a major banking house, as a sec.docxRobin went to work for Titans, Inc., a major banking house, as a sec.docx
Robin went to work for Titans, Inc., a major banking house, as a sec.docx
daniely50
 
Risk Management Program Analysis Part One 1Unsatisfactory0.docx
Risk Management Program Analysis Part One 1Unsatisfactory0.docxRisk Management Program Analysis Part One 1Unsatisfactory0.docx
Risk Management Program Analysis Part One 1Unsatisfactory0.docx
daniely50
 
Risk Management Plan Exercise 1 CIS 6208 IT.docx
Risk Management Plan Exercise    1 CIS 6208 IT.docxRisk Management Plan Exercise    1 CIS 6208 IT.docx
Risk Management Plan Exercise 1 CIS 6208 IT.docx
daniely50
 
Risks, Threats, and VulnerabilitiesScenarioFullsoft, Inc.docx
Risks, Threats, and VulnerabilitiesScenarioFullsoft, Inc.docxRisks, Threats, and VulnerabilitiesScenarioFullsoft, Inc.docx
Risks, Threats, and VulnerabilitiesScenarioFullsoft, Inc.docx
daniely50
 
Rubic_Print_FormatCourse CodeClass CodeNRS-440VNNRS-440VN-OL191Imp.docx
Rubic_Print_FormatCourse CodeClass CodeNRS-440VNNRS-440VN-OL191Imp.docxRubic_Print_FormatCourse CodeClass CodeNRS-440VNNRS-440VN-OL191Imp.docx
Rubic_Print_FormatCourse CodeClass CodeNRS-440VNNRS-440VN-OL191Imp.docx
daniely50
 
RISK RESPONSE STRATEGIES AND PERFORMANCE OF PROJECTS IN KIRINYAGA .docx
RISK RESPONSE STRATEGIES AND PERFORMANCE OF PROJECTS IN KIRINYAGA .docxRISK RESPONSE STRATEGIES AND PERFORMANCE OF PROJECTS IN KIRINYAGA .docx
RISK RESPONSE STRATEGIES AND PERFORMANCE OF PROJECTS IN KIRINYAGA .docx
daniely50
 
RTE Cereal Industry Table of Barriers to Entry”Sept 18, 2017.docx
RTE Cereal Industry Table of Barriers to Entry”Sept 18, 2017.docxRTE Cereal Industry Table of Barriers to Entry”Sept 18, 2017.docx
RTE Cereal Industry Table of Barriers to Entry”Sept 18, 2017.docx
daniely50
 
Rubic_Print_FormatCourse CodeClass CodePCN-518PCN-518-O500Older Ad.docx
Rubic_Print_FormatCourse CodeClass CodePCN-518PCN-518-O500Older Ad.docxRubic_Print_FormatCourse CodeClass CodePCN-518PCN-518-O500Older Ad.docx
Rubic_Print_FormatCourse CodeClass CodePCN-518PCN-518-O500Older Ad.docx
daniely50
 
Rubic_Print_FormatCourse CodeClass CodeNRS-430VNRS-430V-O102Contem.docx
Rubic_Print_FormatCourse CodeClass CodeNRS-430VNRS-430V-O102Contem.docxRubic_Print_FormatCourse CodeClass CodeNRS-430VNRS-430V-O102Contem.docx
Rubic_Print_FormatCourse CodeClass CodeNRS-430VNRS-430V-O102Contem.docx
daniely50
 
Rubic_Print_FormatCourse CodeClass CodeMGT-660MGT-660-O500Strategi.docx
Rubic_Print_FormatCourse CodeClass CodeMGT-660MGT-660-O500Strategi.docxRubic_Print_FormatCourse CodeClass CodeMGT-660MGT-660-O500Strategi.docx
Rubic_Print_FormatCourse CodeClass CodeMGT-660MGT-660-O500Strategi.docx
daniely50
 
RTI Overview 20.0 Includes an RTI overview that is comprehensi.docx
RTI Overview 20.0 Includes an RTI overview that is comprehensi.docxRTI Overview 20.0 Includes an RTI overview that is comprehensi.docx
RTI Overview 20.0 Includes an RTI overview that is comprehensi.docx
daniely50
 

More from daniely50 (20)

Robert Williams, Introduction” (from textbook).docx
Robert Williams, Introduction” (from textbook).docxRobert Williams, Introduction” (from textbook).docx
Robert Williams, Introduction” (from textbook).docx
 
rocess, Physical Distribution, and Logistics Consulting Services.docx
rocess, Physical Distribution, and Logistics Consulting Services.docxrocess, Physical Distribution, and Logistics Consulting Services.docx
rocess, Physical Distribution, and Logistics Consulting Services.docx
 
Rock Crystal         Story by A. Stifter Albert Bier.docx
Rock Crystal         Story by A. Stifter Albert Bier.docxRock Crystal         Story by A. Stifter Albert Bier.docx
Rock Crystal         Story by A. Stifter Albert Bier.docx
 
Rogers Communications Historical BackgroundOne of the Largest an.docx
Rogers Communications Historical BackgroundOne of the Largest an.docxRogers Communications Historical BackgroundOne of the Largest an.docx
Rogers Communications Historical BackgroundOne of the Largest an.docx
 
Rob and Dave run a 100-m race, crossing the finish line in a dead he.docx
Rob and Dave run a 100-m race, crossing the finish line in a dead he.docxRob and Dave run a 100-m race, crossing the finish line in a dead he.docx
Rob and Dave run a 100-m race, crossing the finish line in a dead he.docx
 
ROBERT M. BOHMUniversity of Central FloridaandBRENDA.docx
ROBERT M. BOHMUniversity of Central FloridaandBRENDA.docxROBERT M. BOHMUniversity of Central FloridaandBRENDA.docx
ROBERT M. BOHMUniversity of Central FloridaandBRENDA.docx
 
RobertA multicultural city means a city whose members have a d.docx
RobertA multicultural city means a city whose members have a d.docxRobertA multicultural city means a city whose members have a d.docx
RobertA multicultural city means a city whose members have a d.docx
 
Robin went to work for Titans, Inc., a major banking house, as a sec.docx
Robin went to work for Titans, Inc., a major banking house, as a sec.docxRobin went to work for Titans, Inc., a major banking house, as a sec.docx
Robin went to work for Titans, Inc., a major banking house, as a sec.docx
 
Risk Management Program Analysis Part One 1Unsatisfactory0.docx
Risk Management Program Analysis Part One 1Unsatisfactory0.docxRisk Management Program Analysis Part One 1Unsatisfactory0.docx
Risk Management Program Analysis Part One 1Unsatisfactory0.docx
 
rite an essay that considers the historical relationship between.docx
rite an essay that considers the historical relationship between.docxrite an essay that considers the historical relationship between.docx
rite an essay that considers the historical relationship between.docx
 
Risk Management Plan Exercise 1 CIS 6208 IT.docx
Risk Management Plan Exercise    1 CIS 6208 IT.docxRisk Management Plan Exercise    1 CIS 6208 IT.docx
Risk Management Plan Exercise 1 CIS 6208 IT.docx
 
Risks, Threats, and VulnerabilitiesScenarioFullsoft, Inc.docx
Risks, Threats, and VulnerabilitiesScenarioFullsoft, Inc.docxRisks, Threats, and VulnerabilitiesScenarioFullsoft, Inc.docx
Risks, Threats, and VulnerabilitiesScenarioFullsoft, Inc.docx
 
Risk, Vulnerability, and ThreatsHello Class! Please respond to.docx
Risk, Vulnerability, and ThreatsHello Class! Please respond to.docxRisk, Vulnerability, and ThreatsHello Class! Please respond to.docx
Risk, Vulnerability, and ThreatsHello Class! Please respond to.docx
 
Rubic_Print_FormatCourse CodeClass CodeNRS-440VNNRS-440VN-OL191Imp.docx
Rubic_Print_FormatCourse CodeClass CodeNRS-440VNNRS-440VN-OL191Imp.docxRubic_Print_FormatCourse CodeClass CodeNRS-440VNNRS-440VN-OL191Imp.docx
Rubic_Print_FormatCourse CodeClass CodeNRS-440VNNRS-440VN-OL191Imp.docx
 
RISK RESPONSE STRATEGIES AND PERFORMANCE OF PROJECTS IN KIRINYAGA .docx
RISK RESPONSE STRATEGIES AND PERFORMANCE OF PROJECTS IN KIRINYAGA .docxRISK RESPONSE STRATEGIES AND PERFORMANCE OF PROJECTS IN KIRINYAGA .docx
RISK RESPONSE STRATEGIES AND PERFORMANCE OF PROJECTS IN KIRINYAGA .docx
 
RTE Cereal Industry Table of Barriers to Entry”Sept 18, 2017.docx
RTE Cereal Industry Table of Barriers to Entry”Sept 18, 2017.docxRTE Cereal Industry Table of Barriers to Entry”Sept 18, 2017.docx
RTE Cereal Industry Table of Barriers to Entry”Sept 18, 2017.docx
 
Rubic_Print_FormatCourse CodeClass CodePCN-518PCN-518-O500Older Ad.docx
Rubic_Print_FormatCourse CodeClass CodePCN-518PCN-518-O500Older Ad.docxRubic_Print_FormatCourse CodeClass CodePCN-518PCN-518-O500Older Ad.docx
Rubic_Print_FormatCourse CodeClass CodePCN-518PCN-518-O500Older Ad.docx
 
Rubic_Print_FormatCourse CodeClass CodeNRS-430VNRS-430V-O102Contem.docx
Rubic_Print_FormatCourse CodeClass CodeNRS-430VNRS-430V-O102Contem.docxRubic_Print_FormatCourse CodeClass CodeNRS-430VNRS-430V-O102Contem.docx
Rubic_Print_FormatCourse CodeClass CodeNRS-430VNRS-430V-O102Contem.docx
 
Rubic_Print_FormatCourse CodeClass CodeMGT-660MGT-660-O500Strategi.docx
Rubic_Print_FormatCourse CodeClass CodeMGT-660MGT-660-O500Strategi.docxRubic_Print_FormatCourse CodeClass CodeMGT-660MGT-660-O500Strategi.docx
Rubic_Print_FormatCourse CodeClass CodeMGT-660MGT-660-O500Strategi.docx
 
RTI Overview 20.0 Includes an RTI overview that is comprehensi.docx
RTI Overview 20.0 Includes an RTI overview that is comprehensi.docxRTI Overview 20.0 Includes an RTI overview that is comprehensi.docx
RTI Overview 20.0 Includes an RTI overview that is comprehensi.docx
 

Recently uploaded

會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
中 央社
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
Peter Brusilovsky
 

Recently uploaded (20)

Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 

Royal Commission for Jubail and Yanbu Jubail University Coll.docx

  • 1. Royal Commission for Jubail and Yanbu Jubail University College Computer Science & Engineering Department Cover Page FX-ACA-002 Issue 0 Rev. 1 January 2, 2014 i Exam Type: Assign 1(LT) Semester: 391 Course Code CS 313 Course Title Design and analysis of Algorithms Submission Date WEEK 7(Sunday) PART I TO BE FILLED BY THE STUDENT STUDENT’S NAME ID. No.
  • 2. Course Section TO BE FILLED BY THE CONCERNED DEPARTMENT PART II 1st Marker 2nd Marker Question No. Max Marks Actual Marks Comments/Remarks Actual Marks Comments/Remarks 1 20 2 3 3 3 4 4 Total 30
  • 3. Name: Dr. Ruchi Tuli Name: Signature: Signature: 1. Calculate the time and space complexity(total amount of space required) of the following: (20 Marks) a. Algorithm sum(a[ ], n) [4 Marks] sum =0 for(i=0 to n) sum = sum + a[i] return sum b. Algorithm A1() [3 Marks] int i for(i= 1 to n) print(i)
  • 4. c. Algorithm A3() [4 Marks] int i, j for(i= 1 to n) for(j= 1 to n) print(“hello”) d. int sum(int x, int y, int z) { [2 Marks] int w = x + y + z; return w; } Instructions :- sion. Only hard copy submission
  • 5. e. void Add(int a[ ], int b[ ], int c[ ], int n) { [4 Marks] for (int i = 0; i < n; ++i) { c[i] = a[i] + b[j] } } f. void Multiply(int a[ ], int b[ ], int c[ ][ ], int n) { [3 Marks] for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { c[i] = a[i] + b[j]; }}} 2. Show that 3n3+2n2+7n+9 is O(n3) [3 Marks]
  • 6. 3. Show that n! is O(nn) [3 Marks] 4. Prove that n10 is O(2n ) [4 Marks]