CS计算机代考程序代写 algorithm compiler data structure c++ Homeworks consist of Exercises and Problems. Exercises are shown first and Problems are shown last.

Homeworks consist of Exercises and Problems. Exercises are shown first and Problems are shown last.
Homework 1
Exercises (50 points when you take the HW1 Exercise Quiz)
• Please complete the following exercises at the end of Chapter 1 and the questions for Chapter 2.
• Make sure you are using the 4th edition of the text. The numbering varies in the 5th edition.
• Once you have completed all the work, you can submit your answers by opening up HW1 Exercises and completing the online quiz.
• It is multiple choice, fill in the blank, and short answer
• You do not have to submit a PDF showing your work for the exercises.

Chapter 1 Exercises are at the end of Chapter 1 of the text.
1.2 (b) (The way you read this is Chapter 1 exercise 2b)
1.3(b)
1.3(c)
1.4(c)
1.4(d)
1.6
1.7(a)
1.7(b)
1.8(a)
1.8(b)
1.11
1.13

Chapter 2 Questions
Answer the following questions by reviewing Chapter 2 of the text.

• What level of abstraction is a C++ program?
• What is the function of a compiler?
• What are the attributes of a C++ variable?
• In C++, what is the difference between a global variable and a local variable?
• What is the C++ memory model?
• What is a stack?
• When a function executes in C++, what is the order of allocation on the runtime stack?
• When a function terminates in C++, deallocation from the run time stack takes place in what order?
• What are two kinds of functions in C++?
• What is special about the way arrays are called in C++?
• In C++, main() is a function. What does main() return? What does the operating system do with this return value?
• What is the collection of all the items pushed onto the run-time stack called?
• Discuss the difference between Call-By-Reference parameters and Call-By-Value parameters?
• In C++, a program operates by executing its statements sequentially. Describe the two ways you can alter the sequence by changing the flow of control.
• In C++, there are do, while and for loops. Discuss the differences.
• In C++, there are if/else and switch statements. Discuss the differences.
• What is the definition of recursion?
• What did Bjarne Stroustrup develop?
• What is allocation on the heap known as?
• Structures are a key data abstraction in C++. What do they allow the programmer to do?
• LIFO is the nature of the run-time stack. What does LIFO stand for?
• How does a recursive function end?
• What is a linked data structure?
• What is the binary coefficient b(n,k) for n=7, and k=6?
• What is the Fibonacci sequence to 20 places?

Problems (50 Points)

HW1 problems require you to write 5 C++ programs.
Use the online IDE for C++ here, https://www.onlinegdb.com/

• You will paste the link for your completed C++ programs to this document and will submit through Canvas
• Onlinegdb also has a tutorial for C++ under the “Learn Programming Tab”

Note the logic in these programs should be easy. Their purpose is for you to learn the syntax of C++ and to learn how Call-By-Value, Call-By-Reference and Recursive functions are set up and used.

Each program submitted needs to have:
a) a written algorithm in the comments at the top of your submitted code.
b) your commented source code with your name, date & assignment in a comment at the top
c) Submit your code by pasting the share link from Onlingegbd to this document

Problem 0 (5 points)
Write a well formatted and commented C++ program that outputs the word “Hello” and your name. The following is example code for Problem 0.
Example Problem 0:
Source Code for Problem 0:

/*CSC 376 HW1 Problem 0
Author: Michael Davis
January 18, 2021
*/
/* Algorithm
This program will output the word Hello Mike to the screen.
*/

#include
using namespace std;
char name[] = “Mike”; //Character array holding name
int main() {
cout<<"Hello " <2
To test – output for P(4)=11 P(6) = 29 and P(7) =47
Hint: main shall call a function int par(int n) that returns 3 if n=1, it returns 4 if n = 2, and it returns par(n-1) + par(n-2) if n>2.
Sample Output (Your name will replace mine & yours will be P(5))
Mike shows P( 7) has 47 units
Paste your link here
Problem 4b: (7 points) Draw a call tree for P(5). This should look similar to Figure 2.30 in the textbook. Note: the numbers just above the ovals are the return values. You may hand draw and scan, but you can complete in Google Suites or an App of your choice.
Show your call tree here