C++ Answers

Questions answered by Experts: 9 913

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

Note: No code is required.


Consider the following tree


root=A


root->left=B


root->left->left=C


root->left->left->right=D


root->left->right=E


root->left->right->right=H


root->left->right->left=F


root->left->right->left->right=G


root->right=I


root->right->left=J


root->right->left->left=K


root->right->right=L


root->right->right->right=N


root->right->right->left=M




Task :


Write down the following for the above tree


1)In Order Traversal


2)Pre Order Traversal


3)Post Order Traversal


Note: No code is needed only tree diagram after performing the operations are needed.


Consider the following :

root=5

root->left=3

root->left->right=4

root->left->left=2

root->left->left->left=1

root->right=8

root->right->left=7

root->right->left->left=6

root->right->right=14

root->right->right->right=15

root->right->right->left=13

root->right->right->left=10

root->right->right->left->left=9

root->right->right->left->right=11


Task:

Your task is to Draw the modified Tree diagram under each of the following operations.(Note :the two operations are independant.Each of them starts from the above tree)

a)Deletion of the key with data 4

b)Insertion of the key 16


Note : No global declarations.


Consider following Binary Tree

root=50

root->left=17

root->left->left=12

root->left->left->left=9

root->left->left->right=14

root->left->right=23

root->left->right->right=19

root->right-=72

root->right->right=76

root->right->left=54

root->right->left->right=67


Your task is to write its array representation.



NOTE: No code is required


Consider a BST which is constructed by the following node values(in the given order):

23,15,37,9,20,30,33.

Draw the BST and answer the following questions:

1)Draw BST for above data.

2)How many nodes are requiredto make a full tree?

3)What is the maximum level number of the tree?

4)What nodes are on Level 3?

5)Which nodes(s) has sibling?


Draw avl tree diagram using the following keys

12,13,44,43,99,0,88,13,43,2,22

Draw diagram after each step

Note:

No code required only diagrams after each step are needed.


You have been contracted by client to develop a program using c++. The Program must have the
following specifications.
The program must:
a. Allow the user to enter the full name of the university - “Ghana Communication Technology
University”.
b. Print the entire name for the university.
c. Count the number of ‘e’ in “Ghana Communication Technology University” and display.
d. Print the last 21 characters in “Ghana Communication Technology University”.
e. Replace the string “Ghana” in “Ghana Communication Technology University” with “Accra”
and print the new name.

A housing society is represented by a 3D plane. We have a class house which

stores the location of a house of three persons using x, y and z coordinates of

plane. Another class market which stores the location of a main market. Each class

should initialize the data members using parameterized constructor. Keep the data

members of all the classes private. Also display the location of houses and market.

Calculate the distance of houses of all the persons from the market and display

which person’s house is far away from the market. Also display which person has

nearest distance from the market.

The class manager has the access to both class house and market so it swaps the

location of the market with the house of a person that has the largest distance

with the market. in C++


The Ghana Navy has been paying its newly employed staff on ‘table-top’, a practice that has attracted much criticism from the military command. On a trial basis they have engaged your services to design a payment system with the following functionalities.
Write a program to create a class for counting the number of objects created
and destroyed within various block using static data member, constructor
and destructors.
Write a program using copy constructor to copy data of an object to another
object.
LATEST TUTORIALS
APPROVED BY CLIENTS