CPSC 2430 Assignment #3 solution

$24.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (6 votes)

P3 exercises your understanding of:
Binary Search Trees (BST), and thus, multiply linked objects
Recursion
Simulation of recursion with a stack data structure

Submitted programs must:
1) provide the requested functionality
2) be appropriately documented (thorough but concise)
3) use C++ constructs as intended

ALL ASSUMPTIONS SHOULD BE REASONABLE AND CLEARLY STATED
DO NOT HARD CODE

Write a C++ program that:
1) defines a primeDupBST type (class) that:
a. provides all the capabilities of a standard BST
search, insert, and remove
b. is a well-designed C++ class
i. copying is handled appropriately
ii. constructor and destructor defined and implemented
c. implements recursive inorder traversal
d. implements an ITERATIVE preorder traversal
e. does not store duplicates of non-prime numbers
f. stores ‘duplicates’ of PRIME numbers using a count field
i. increment count upon insertion
ii. decrement count upon deletion
iii. remove element if count goes to zero
2) uses a driver to test this primeDupBST type on integer data
a. initial construction via random number generator
b. arbitrarily insert and remove values
c. dump preorder traversal to output file “P3out.txt”
d. dump inorder traversal to output file “P3out.txt”

TEST YOUR PROGRAM BEFORE SUBMISSION

Name your C++ files: primeDupBST.h, primeDupBST.cpp, P3.cpp
Submit to both CANVAS and cs1