ANALYSIS OF ALGORITHMS PROBLEMSAuthor: Kasun Ranga WijeweeraEmail: krw19870829@gmail.com(TOTAL MARKS = 40)a) What do you m...
 Worst Case: The amount of time a program would take on the worst possible inputconfiguration (2.5 marks)f) Write the def...
Upcoming SlideShare
Loading in...5
×

Analysis of Algorithms Problems

73

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
73
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Analysis of Algorithms Problems"

  1. 1. ANALYSIS OF ALGORITHMS PROBLEMSAuthor: Kasun Ranga WijeweeraEmail: krw19870829@gmail.com(TOTAL MARKS = 40)a) What do you mean by the term “Algorithm” in computer science? (5 marks)A well defined (2 marks) finite set (2 marks) of steps a computer follows to solve a problem(1 marks)b) State five properties of algorithms (10 marks)i. It must be correct (2 marks)ii. It must be composed of a series of concrete steps (2 marks)iii. There can be no ambiguity as to which step will be performed next (2 marks)iv. It must be composed of a finite number of steps (2 marks)v. It must terminate (2 marks)c) State five factors affecting the running time of algorithms (10 marks)i. Speed of the machine running the program (2 marks)ii. Language in which the program was written (2 marks)iii. Efficiency of the compiler that created the program (2 marks)iv. The size of the input (2 marks)v. Organization of the input (2 marks)d) Briefly explain the two conflicting goals in computer program design (5 marks)i. To design an algorithm that is easy to understand, code, debug (2.5 marks)ii. To design an algorithm that makes efficient use of the computer’s resources (2.5marks)e) Define the terms “Average case” and “Worst case” (5 marks) Average Case: The amount of time a program might be expected to take on “typical”input data (2.5 marks)
  2. 2.  Worst Case: The amount of time a program would take on the worst possible inputconfiguration (2.5 marks)f) Write the definition of Big-O notation and illustrate using a graph (5 marks)A function g (N) is said to O (f (N)) if there exists constants c0 and N0 such that g (N) is lessthan c0 * f (N) for all N > N0 (2 marks)(3 marks)NC0* f (N)g (N)Does notmatter

×