Questions: 11 448

Answers by our Experts: 10 707

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Recall that a full binary tree is a binary tree where each level of the tree has the maximum


number of nodes possible.


a. If the level of the root of a non-empty full binary tree is level 1, the level of the root's


children is level 2, etc., how many nodes are on level i, i ≥ 1?


b. If a non-empty full binary tree has n levels (or a height of n), how many nodes does the


tree have in total? Express your answer in closed form (i.e. do not use "..." in your final


answer).


c. Prove that the number of leaves in a non-empty full binary tree is 1 more than the number


of non-leaves. When you prove this, don't just show an example. Write your proof in


general for ANY non-empty full binary tree.

Consider the two different techniques we used for implementing traversals of a binary


tree. Why must we check before the call to preorder when implementing as a method,


whereas we could check inside the call when implementing as a function?



You wish to create a database of stars. For each star, the database will store several megabytes of data. Considering that your database will store billions of stars, choose the data structure that will provide the best performance. With this data structure you should be able to find, insert, and delete stars. Justify your choice. 


A student spends a majority of his weekend playing and watching 

sports, thereby tiring him out and leading him to oversleep and often 

miss his Monday 8 AM math class. Suppose that the tuition per semes-

ter is $25,000 and the average semester consists of 15 units. If the math 

class meets three days a week, one hour each day for 15 weeks, and is a 

four-unit course, how much does each hour of math class cost the stu-

dent? Design an algorithm that computes the cost of each math class


This program will read integers from a file and find results from these integers.

Open the file, test to make sure the file opened. Use a loop to read the integers and process each integer as it is read. When End Of File is reached, close the file.

After all of the integers have been read and processed, print the results for the following output:

  • The integer count:
  • The sum of the integers:
  • The smallest integer:
  • The largest integer:
  • The average of the integers:

Use notepad, vim, or other simple text editor to create a file named file1.txt containing the following, with one integer per line.

Test the program two times.

Use the following data in the first test:

11
9
18
22
27
33
21
  

For the second test add an additional line containing the number 40.


Below are the structs defined in section 1.3. Your task now is to create complete program that utilizes these structs. Be creative on how you will use the structs in your program.



struct NameType{


string first;


string middle;


string last;


};



struct AddressType{


string address1;


string address2;


string city; string state;


string zip;


};



struct DateType{


int month;


int day;


int year;



};



struct ContactType{


string phone;


string cellphone;


string fax;


string pager;


string email;


};



struct EmployeeType{


NameType name;


string emp_id;


AddressType address;


DateType hireDate;


DateType quitDate;


ContactType contact;


string dept_id;


double salary;



};

Provide a loop with a menu. Repeat until the user selects quit. Prompt the user to select one of the menu items. Test for numbers that are not in the menu, provide an error message, and then continue. The menu shall contain:

1. Square   pattern
2. Triangle pattern
3. Diagonal pattern
4. Reverse diagonal pattern
5. Quit
  

After the user selects a pattern, allow them to specify the size. If the size is smaller than 1 or larger than 9, give them an error message and repeat the specification of the size.

Once the user has correctly selected a pattern and a size, print the pattern using the size specified.

Pattern 1 is a square. Example for size 4:

4444
4444
4444
4444
  

Pattern 2 is a triangle. Example for size 5:

5
55
555
5555
55555
  




Test the program once using each of these values in order:

Pattern 9; when that is rejected try:

Pattern 1, size 11; when that is rejected use:

Pattern 1, size 3

Pattern 2, size 4

Pattern 3, size 5

Pattern 4, size 6

Quit





This program will read integers from a file and find results from these integers.

Open the file, test to make sure the file opened. Use a loop to read the integers and process each integer as it is read. When End Of File is reached, close the file.

After all of the integers have been read and processed, print the results for the following output:

  • The integer count:
  • The sum of the integers:
  • The smallest integer:
  • The largest integer:
  • The average of the integers:

Use notepad, vim, or other simple text editor to create a file named file1.txt containing the following, with one integer per line.

Test the program two times.

Use the following data in the first test:

11
9
18
22
27
33
21
  

For the second test add an additional line containing the number 40.



An ATM allows a customer to withdraw a maximum of $500 per day.


If a customer withdraws more than $300, the service charge is 4% of


the amount over $300. If the customer does not have sufficient money


in the account, the ATM informs the customer about the insufficient


funds and gives the customer the option to withdraw the money for a


service charge of $25.00. If there is no money in the account or if the


account balance is negative, the ATM does not allow the customer to


withdraw any money. If the amount to be withdrawn is greater than


$500, the ATM informs the customer about the maximum amount


that can be withdrawn. Write an algorithm that allows the customer to


enter the amount to be withdrawn. The algorithm then checks the total


amount in the account, dispenses the money to the customer, and debits


the account by the amount withdrawn and the service charges, if any.

use dynamic array as the underlying data structure to hold the list contents. The array will hold integer data. Here are the functions that your program should offer ( options in MENU):


1. Insert an item

Insert function will insert the value at the start of the list. Tell the user how many list elements are shifted to make room for new item.


2. Delete an item


It will ask the user for the value, if the value is present, it will be deleted from the list and function displays how many items are shifted to delete the value


3. Print out the items in the list


LATEST TUTORIALS
APPROVED BY CLIENTS