Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions