Giter VIP home page Giter VIP logo

cs311-bst's Introduction

CS311 Programming Assignment 6

Total points: 10

In this assignment, you will implement a Binary Search Tree (BST) data structure in C++. Please add your code into the "BST.cpp" file to complete the member functions defined in the header file "BST.h". You may add additional functions to the BST class, but don't change the existed definitions, which are required by the testing programs.

BST Data structure

Your program will implement at least the following BST functions:

  • bool insert(T element) Insert a new element into the BST. The updated tree remains a BST.
  • bool find(const T & query) Search the BST for a query. Return true if the query is found, otherwise false.
  • Node* getRoot() Return pointer to the root node of the BST. Return nullptr if the BST is empty.
  • Node* getLeftMostNode() Return pointer to the left-most node in the BST. Return nullptr if the BST is empty.
  • unsigned int size() Return the number of elements in the BST.
  • int height() Return the maximum height of the BST. The root is assumed to be at height 0.
  • void printInorder(Node* node) Print the subtree at the given node using inorder traversal.
  • Node* successor(Node *node) Return the successor of the current node in the BST, or nullptr if none exists.
  • void clear() Remove all elements from the BST and deallocate all nodes.
  • Appropriate constructors and destructors.

Submission

You have to upload BST.h and BST.cpp into gradescope for autograding. You don't need to upload anything in canvas.

cs311-bst's People

Contributors

clement-muth avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.