Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with this C++ project. Overview: For problems 1(a) of this assignment, you will need a C++ compiler. In order to receive credit, your

Need help with this C++ project.

Overview: For problems 1(a) of this assignment, you will need a C++ compiler. In order to receive credit, your program must compile and run; and you must provide the actual source code file so that I can compile and run your program (e.g. the file you modified or created ending in .cpp). Examples on how to import existing source code files into your compiler are provided in the file called Importing Source Code.pdf. The remaining problems for the assignment must be written up within a single Microsoft Word document. You must include your name and course number within all files that you submit, including source code files as a comment at the top of each file that you create or modify. 1. [6 points] Recursion. Read the assigned chapter and notes for Week 1 located in the Learning Modules area in Blackboard. Then provide solutions for the following: (a) [3 points] Download the h.zip file, then implement a recursive function called h(), which can be directly translated into C/C++ from the following mathematical definition:

(b) [1.5 points] What type of recursion does the h() function in part (a) use? Briefly explain your answer. (c) [1.5 points] Explain the recursive function design rule that Excessive Recursive functions typically violate. Also, specifically describe why violating this rule is a problem. 2 2. [5 points] Complexity Analysis. Begin by reading the assigned chapter and notes for Week 2 located in the Learning Modules area in Blackboard. Then answer the following questions: (a) [2 points] What is the asymptotic complexity (big-O) of the following function? Briefly explain why. Note: No programming is necessary for this problem. Just tell me what the big-O of the function, and provide a couple of sentences explaining how you arrived at the solution. int pow(int n, int exponent) { int result = 1; for (int i=0; i < exponent; i++) { result *= n; } return result; } (b) [3 points] Briefly describe what is meant by a P, NP, and NP-Complete algorithm. Give an example of each.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

10th Edition

0137916787, 978-0137916788

More Books

Students also viewed these Databases questions