/test

Primary LanguageC++GNU General Public License v3.0GPL-3.0

Introduction to Algorithm Analysis

This is a written assignment that refers to code that was presented during the first class meeting. You may wish to run the code from class perhaps with the debugger or modified experimental purposes, but no code is to be submitted for this assignment. All code from the class session is included in this repository. Prepare your responses in Markdown format in file RESPONSES.md.

For some tips on using Markdown check out these online resources:

Implementations of several recursive algorithms were presented in class. The run time of any algorithm is typically dependent on some input value or parameter. The recursive functions in these examples will be called a varying number of times depending on that input or parameter value.

For each of the programs listed below, answer the following questions:

  • What input or parameter value impacts the number of times the recursive function will be called?
  • Give three specific examples of input/parameter values and, for each, state the number of times the recursive function is called.
  • Devise a formula with respect to n that describes the number of times the recursive function will be called, where n is either the value passed or some property of the value passed (e.g. n might be the length of a string or the size of an array).

Answer these questions for the followin

  • factorial2.cpp
  • ireverse2.cpp
  • sreverse2.cpp
  • permute.cpp
  • tower.cpp
  • fibonacci1.cpp (presented in video lesson)
  • fibonacci2.cpp (presented in video lesson)