Question: Using C++ In this lab we are going to finish the Mlist class, and begin to develop and implement the template class Mtree. The interface

Using C++

In this lab we are going to finish the Mlist class, and begin to develop and implement the template class Mtree.

The interface is here:

#include

using namespace std;

template class Lnode { public : T data; Lnode *lptr; Lnode *rptr; };

template class Mlist { public : Mlist(); void add(T x); void add(,int i,T x); void del(T x); void delete(int i); T getfront(); T getback(); T operator[] (unsigned int i);

private : Lnode *first; Lnode *last; int lsize; };

Add the following functions to the Mlist class. void add(,int i,T x); void delete(int i); T getback(); T operator[] (unsigned int i);

Write the functions and test them with a main program.

Next create the interface for the class Mtree along with function stubs. The interface is here:

#include

using namespace std;

template class Tnode { public : T data; Tnode *lptr; Tnode *rptr; };

template class Mtree { public : Mtree(); void add(T x); bool find(T x); private : Tnode *root; int tsize; };

Add stubs for each member function and test the compilation (c++ -c).

Write the functions and test the compilation.

Write a main program that tests the class functions. (Use the pseudo-random number generator to create a list and add and remove elements from the list

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!