Answer to Question #254262 in Algorithms for Sonu

Question #254262

Define what an algorithm is and outline the characteristics of a good algorithm. Write the algorithms to display the Fibonacci series and the factorial value for a given number using Pseudo code. Determine the steps involved in the process of writing and executing a program.

Take a sample number and dry run the above two algorithms. Show the outputs at the end of each iteration and the final output. Examine what Big-O notation is and explain its role in evaluating efficiencies of algorithms. Write the Python program code for the above two algorithms and critically evaluate their efficiencies using Big-O notation.


1
Expert's answer
2021-10-20T23:55:30-0400

A)



START

   Step 1  Declare variables A, B, C,n

   Step 2  Set A = 0, B = 0

   Step 3  DISPLAY A, B

   Step 4  C = A + B

   Step 5  DISPLAY C

   Step 6  Set A = B, B = C

   Step 7  REPEAT from 4 - 6, for n times

STOP



B)



Start

   Step 1: Declare variables n, fact, i

   Step 2: Read number from User

   Step 3: Initialize variables fact=1 and i=1

   Step 4: Repeat Until i<=number

            4.1 fact=fact*i

            4.2 i=i+1

   Step 5: Print fact

Stop


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS