Implement stack-based bidirectional

Assignment Help C/C++ Programming
Reference no: EM131009033

RBLL Trees and ADT-Based Iterators

ADT-based Iterators for BSTs.

Educational Objectives: After completing this assignment, the student should be able to accomplish the following:

  • Describe and explain in detail the concept forward and bidirectional iterators on Set and Map container classes.
  • Implement Stack-based bidirectional "in-order", "pre-order", and "post-order" iterators for binary trees
  • Implement Queue-based forward "level-order" iterators for binary trees
  • Explain the utility of iterators on Sets and Maps
  • Give examples of of Set and Map applications that are simple with iterators but difficult without iterators.
  • Explain what the runtime and other efficiency considerations are between RBLL Trees and BSTs.
  • Explain what the runtime and other efficiency considerations are between ADT-based iterators and threaded iterators.

Operational Objectives: Implement class templates InorderBTIterator and LevelorderBTIterator and use these classes to complete the implementations of the class templates BST_ADT and RBLLT_ADT.

Deliverables: Four files:

bt2iter_adt.h   # contains the iterator class templates
bst_adt.h       # class BST_ADT
rbllt_adt.h     # class RBLLT_ADT
log.txt         # your project work log

Discussion

To create the various classes from "scratch" (or "whole cloth") is a large and somewhat open-ended project that is not at all beyond the capabilities of students at your level. But it would be much too much work. Therefore you have the task of completing an implementation that has been worked out and for which many of the technical details have been supplied. This leaves you with a different, but more manageable, two-part mission:

  1. Understand the overall design as well as the implementation in complete detail.
  2. Supply missing implementations of some key methods.

Regarding I. There are several classes involved that are inter-related, as follows:

  1. The iterator classes - these are all started in the file bt2iter_adt.start and you are required to complete them in the deliverable file bt2iter_adt.h:
    template < class C > InorderBTIterator;
    template < class C > PreorderBTIterator;
    template < class C > PostorderBTIterator;
    template < class C > LevelorderBTIterator;
    

    These take a parameter C that is treated as a binary tree class built from nodes with certain properties. Any class C that has an interface and structure assumed by the iterator classes will work with them.

    The iterator class InorderBTIterator is a fully functional bidirectional iterator type (see notes on Iterators). The class LevelorderIterator is a fully functional forward iterator type.

  2. The container classes, in various files:
    template < typename T , class P > BST_BASE;     // in file bst_base.h
    template < typename T , class P > BST_ADT;      // started in file bst_adt.start, delivered in file bst_adt.h
    template < typename T , class P > RBLLT_ADT;    // started in file rbllt_adt.start, delivered in file rbllt_adt.h
    

    These classes are all variations on BST. The separation of many of the functionalities into the base class BST_BASE serves mainly (and not insignificantly!) as a code re-use mechanism. BST_BASE does not define its own Iterator type. The two derived class offer variations on choice of Iterator. Note that BST_ADT is derived from BST_BASE amd RBLLT_ADT is derived from BST_ADT. Opportunities for code re-use are thus maximized.

  3. Because rbllt_adt.start has a complete implementation of RBLLT_ADT, except for a few typedef enhancements, we will postpone releasing that file until the deadline for project 4 is passed. All preliminary testing can be done with BST_ADT, and it should not require much time to encompass RBLLT_ADT in final testing at that time.

Procedural Requirements

  1. The official development/testing/assessment environment is specified in the Course Organizer.

  2. Create and work within a separate subdirectory cop4530/proj5.

  3. Begin by copying all files in the directory LIB/proj5 into your proj5 directory. At this point you should see these files in your directory:

    bt2iter_adt.start    # BT iterator classes [w partial implementations]
    bst_adt.start        # class BST_ADT, derived from BST_BASE  [partial implementation]
    rbllt_adt.start      # class RBLLT_ADT, derived from BST_ADT [partial implementation]
    fbst.cpp             # test harness for all the BST classes
    ranstring.cpp        # random string generator
    ranuint.cpp          # random uint generator
    makefile.adt         # builds test exectuables and utilities
    deliverables.adt     # submission configuration file
    

    Then copy these relevant executables from LIB/area51/:

    fbst*.x
    frbllt*.x
    mbst*.x
    mrbllt*.x
    
  4. Create the files bt2iter_adt.h, bst_adt.h, rbllt_adt.h containing the template classes.

  5. Test thoroughly.

  6. Submit the assignment using the command submit.sh.

    Warning: Submit scripts do not work on the program and linprog servers. Use shell.cs.fsu.edu to submit assignments. If you do not receive the second confirmation with the contents of your assignment, there has been a malfunction.

Code Requirements and Specifications

  1. Begin by copying the start files to the code files:

    cp bt2iter_adt.start  bt2iter_adt.h
    cp bst_adt.start      bst_adt.h
    cp rbllt_adt.start    rbllt_adt.h
    

    Then modify these copies into the deliverable code files.

  2. Don't change the code already supplied in the start files.

  3. Complete the implementations where there is missing code.

  4. Do not copy/paste code, even from supplied sources such as lecture notes. All code used in completing implementations should be typed by your own hands.

Hints

  • Note that fbst.cpp has 4 possible ElementType definitions and 4 possible BST definitions that can be selected by the comment/uncomment technique. You need to use that technique to proliferate fbst.cpp to these tests:

    fbst_adt_CHAR.cpp       # BST = BST_ADT,   ElementType = CHAR
    fbst_adt_int.cpp        # BST = BST_ADT,   ElementType = int
    fbst_adt_String.cpp     # BST = BST_ADT,   ElementType = fsu::String
    frbllt_adt_CHAR.cpp     # BST = RBLLT_ADT, ElementType = CHAR
    frbllt_adt_int.cpp      # BST = RBLLT_ADT, ElementType = int
    frbllt_adt_String.cpp   # BST = RBLLT_ADT, ElementType = fsu::String
    

    Similarly, mbst.cpp proliferates to

    mbst_adt_int.cpp        # BST = BST_ADT,   ElementType = int
    mbst_adt_String.cpp     # BST = BST_ADT,   ElementType = fsu::String
    mrbllt_adt_int.cpp      # BST = RBLLT_ADT, ElementType = int
    mrbllt_adt_String.cpp   # BST = RBLLT_ADT, ElementType = fsu::String
    

    You need to create these tests, each of which is required by the makefile

Attachment:- proj.zip

Reference no: EM131009033

Questions Cloud

Problem regarding the real estate : A real estate broker purchased 3 two- bedroom houses in a depressed market for a combined cost of $71,000. He expects the cleaning and repair costs on each house to average $3700
What five vital signs does the apgar scale measure : What five vital signs does the Apgar scale measure? How does the assessment of these signs help with the development process
Create a random variable for the collector : a) Define your random variables, and use them to create a random variable for the collector's net income. b) Find the mean (expected value) of the net income.
Define the pearson correlation coefficient : Define the Pearson Correlation Coefficient. Define correlation. Define a scatter plot. Define the Point-biserial Correlation Coefficient
Implement stack-based bidirectional : Describe and explain in detail the concept forward and bidirectional iterators on Set and Map container classes and implement Stack-based bidirectional "in-order", "pre-order", and "post-order" iterators for binary trees
Problem regarding the online applications : Researchers for an online market- ing company suggest that new customers who have to become a member before they can check out on the website are very intolerant of long applications. One way to rate an application is by the total number of keystr..
Problem regarding the movie rentals : To compete with Netflix, the owner of a movie rental shop decided to try sending DVDs through the mail. In order to determine how many copies of newly released titles he should purchase, he carefully observed turnaround times. Since nearly all of ..
Calculating the mean : a) Define your random variables, and use them to express the farmer's net income. b) Find the mean of the net income. c) Find the standard deviation of the net income. d) Do you need to make any assumptions in calculating the mean? How ab..
Problem regarding the bike sale : Define random variables and use them to express the bi- cycle shop's net profit. What's the mean of the net profit?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a class dataset

Write a class DataSet that computes the largest and smallest values in a sequence of numbers.

  Enter the temperature at noon of each of the five days

Write a program that allows each employee to enter the temperature at noon of each of the five days and displays the highest, lowest, and average (mean) temps.

  Design a module named getnumber which uses a reference

Design a module named getNumber which uses a reference parameter variable to accept an Integer argument. The module should prompt the user to enter a number and then store the input in the reference parameter variable.

  Write the cpp code for controversial issue of global warming

Write the C++ code for controversial issue of global warming has been widely publicized by the film An Inconvenient Truth, featuring former Vice President Al Gore.

  Program that can serve as a simple calculator

Write a program that can serve as a simple calculator. This calculator keeps track of a single number (of type double) that is called result and that starts out as 0.0. Each cycle allows the user to repeatedly add, subtract, multiply, or divide by..

  Develop data structures - chord system

Develop data structures which are suitable to hold required information for each peer in a CHORD system. Note that index nodes can hold local information only

  Worst-case and best-case running times

a. Write a pseudocode for this algorithm. b. What are the worst-case and best-case running times for this sorting algorithm?

  Write me a function that finds the smallest item in an array

Write me a function that finds the smallest item in an ArrayBag (by reference) and returns true if the arrayBag is not empty and false otherwise.

  Program to not accept a negative birth rate, negative death

I need this program to not accept a negative birth rate, negative death rate, or a population less than 2.

  Calculate monthly payment and amortization schedule for loan

Write a C program that calculates the monthly payment and amortization schedule for the loan. The program should prompt the user to enter the loan amount, the annual interest rate, and the number of years the loan will run.

  Write the prototype and header for a function

Write the prototype and header for a function called calculate. The function should have three parameters: an int, a reference to a double, and a long (not necessarily in that order). Only the int parameter should have a default argument, which is..

  Compare the following strategies with programming time

For a certain program, 1% of the code accounts for 50% of the execution time. Compare the following strategies with respect to programming time and execution time. Assume that it would take 100 man-months to write it in C, and that assembly code i..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd