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.
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)
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.
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".
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.