Giter Site home page Giter Site logo

cs1c_project03_lazydeletion's Introduction

Binary Search Tree with Lazy Deletion

#CS1C Foothill College November 1, 2015

The project is to make a binary search tree implement lazy deletion with the use of a boolean attribute named "deleted" that is in the node class associated with the tree.

The first task was to get it to work on integers and then apply it to strings read into the program from a text file. The file was to drive it to simulate an inventory in the supermarket buy stocking and removing items.

The challenge was to get the insert, remove, find, findMin, findMax etc. functions to accurately work with both states of the tree 1) with nodes present but "soft deleted" by adjusting the boolean attribute to true. and 2) the state of the tree where the nodes were actually deleted.

  1. The project drove home the use of recursive methods that were necessary to traverse the tree. Lots of exposure to using those methods here.

  2. The use of generic classes and methods. Kinda unhappy with the number of warnings I'm still getting, put the utility of this strategy and the implementation is becoming evident.

  3. The use of Functor class to give more degrees of freedom passing a method around through the use of an interface with a class that has one method and no instance variables in it. This is sort of a work around the fact that Java does not allow functions to be passed in as an argument -- a first class variable I believe it is called -- like javascript and other language do.

  4. The utility of the Functor pattern inspired me to work on creating a more controlled an documented testing process. In this project I created a testing class with output methods to show the various states of the tree. The debugging methods can be toggled on or off through the use of a boolean that is passed in as an argument with the testing class object is instantiated.

  5. The second part of the project was to take a tree of SongEntry nodes and an Itunes store simulation to populate a tree of custom nodes that carry strings. My strategy on this was to add an attribute to the primary node (LazySTNode) and use the base methods in the LazySearchTree class modifying them by adding methods that utilized them in the class that created the tree of SongEntry nodes. I got it to populate the tree of SongEntry nodes and was able to find a node based on song title and pull out data as needed from the associated SongEntry node. I ran out of time to polish this up.

cs1c_project03_lazydeletion's People

Contributors

dmgudeman avatar bitam avatar

Watchers

James Cloos avatar  avatar

Forkers

huige555551

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.