Compare the execution times of the two versions of program

Assignment Help Computer Engineering
Reference no: EM132103874

Problem 1

The binomial coefficient, binom(n,m), occurs frequently in mathematics. This value can be computed recursively as follows:

binom(n,m) = binom(n-1,m) + binom(n-1,m-1), where 0 = m = n, binom(n,0) = 1, and binom(n,n) = 1.

Write a C program to compute binom(n,m) recursively. The values for n and m should be passed as command-line arguments with appropriate error checking.

Measure the execution time of your program as you vary the values of m and n. Plot this execution time as a function of n with different lines for various values of m. You should measure the execution time for each data point at least five times. Choose values of m and n such that your execution time ranges from less than a second to more than 30 seconds. What relationship do you see between m, n, and the execution time?

Problem 2.

Repeat Problem 1, but compute binom(n,m) iteratively, that is, without recursion. Measure the execution time of your program and compare the execution times of the two versions of the program. Which one is faster? Why?

Reference no: EM132103874

Questions Cloud

Can you reduce the stalls for this code : Re-arrange the loop without unrolling. You can move individual instructions, however the output of this dummy loop should be exactly the same.
Why does dna synthesis use rna primase : Why does DNA synthesis use RNA primase instead of DNA primase?
Purchase computers for nick business : Jason, who is very knowledgeable regarding computers, agrees to purchase computers for Nick's business.
What circumstances would cause you to do those things : Why would you worry about doing any privilege escalation or leaving backdoors? What circumstances would cause you to do either of those things?
Compare the execution times of the two versions of program : Write a C program to compute binom(n,m) recursively. The values for n and m should be passed as command-line arguments with appropriate error checking.
What are the characteristics of an ideal memory : What are the characteristics of an ideal memory? Explain the concept of locality of reference both with respect to instructions and data.
Access to elements that have been inserted into the queue : Access to elements that have been inserted into the queue is limited to inspection and removal of the elements with smallest and largest priority only.
Calculate the number of mantissa digits : Using a technique explained in the class, calculate the number of mantissa digits and the unit round-off on the machine that you will use for this course.
What are some examples of marketing activities : What are some examples of "marketing" activities that are associated with the Summer Olympics? How does global marketing

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd