Problem 1

Write a program that uses an array of strings to store a three-level complete binary tree with eight leaf nodes. Add values A, B, C, D, E, F, G, and H at the eight leaf nodes.

Problem 2

You are required to write a function for printing address labels. To print each address label, you need the main program to provide you with the following information: first name, last name, city, and zip code. However, you are required to design your function in such a way that the main program can only provide one single variable as a parameter when it calls your function. In other words, the main program's calls your function should have the following form:

print_address_label (my_addresss);

Write the code for your function for printing the address label. Also write the code for all parts of the main program that are required to declare the variable my_address shown in above example call to your function. (You need not write any other part of the main program; you only need to write the parts required to declare variable my address)

Problem 3

Write a program that (a) defines a structure called customer_record, which contains following fields (use appropriate type for each field): last_name, first_name, account_number, and monthly_fee. (b) Create a variable v of type customer_record, (c) read values of each of the fields of v. (d) Finally, print the values of all fields of v.

Problem 4

The diagram below shows the data structure already created by the main program before it calls the mystery function() shown on the next page. Note that the main program calls the mystery function() with two parameters: (i) the root of the tree (which is a pointer shown in the diagram below as root), and (ii) a string with value "New".

a) First, add comments to the mystery function() to describe what each part of the function does.

b) Then summarize what the entire function does in a separate paragraph, as well as by showing the changes it makes to the data structure by appropriately modifying the following diagram for the original data structure. see image.

#include< iostream>
using namespace std;

struct TREE_NODE {
string name;
TREE_NODE* l_chid = NULL;
TREE_NODE* r_chid = NULL;
}

void mystery_function (TREE_NODE* tn, string s) {
TREE_NODE* n_tn = tn;
while (n_tn->l_chid != NULL) {
n_tn - n_tn->1_chid;
}

n_tn->1_chid = new TREE_NODE;
n_tn->1_chld->name = s;

// The main program is not shown, but note two things
// about main().
// 1) when it calls mystery_function(), main() has
// already created the data structure shown on the
// previous page,
// 2) main() calls the mystery function with two
// parameters:
// (a) the root of the tree (which is a pointer), and
// (b) a string with value "New".

Problem 5

Write a program to create the data structure shown in the following diagram. Each box in this diagram depicts a data structure that includes the name of one player in the game and pointers to identical data structures for the players located directly to its north, east, west, and south. (Note it is possible that there is no player in any one or more directions. In that case, there is no data for the player in that direction and the corresponding pointer in this player's data structure must have value NULL.) see image.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.