Giter VIP home page Giter VIP logo

smartar's Introduction

smartAR

vehicle registration software

The SmartAR ADT is an ADT that combines two ADTs, a Sequence and a Hashtable. The Sequence is implemented using a doubly linked list, and the Hashtable is implemented using an ArrayList that supports separate chaining. Each element of the ArrayList is a bucket. Collisions are handled through inserting the key-value pair node inside its corresponding bucket, and at the head of the bucket. Therefore, the hashCode() function is called upon the key and its result is then converted into an index within the range (<) of the number of buckets. This ArrayList of buckets is set by default to size 10, and doubles if the load factor (n/N) surpasses 0.7. Here, assume the doubling will yield a prime number. Each of the ADTs are implemented in their separate classes and both have their version of the required methods that are: allKeys(), add(key, value), remove(key), getValues(key), nextKey(key), prevKey(key) and previousCars(key). Inside the SmartAR class, the previously mentioned methods along with setThreshold(threshold), setKeyLength(Length) and generate(n) are implemented. The SmartAR is what we instantiate in the driver file. An instance of SmartAR, once created, will simultaneously create an empty Sequence and an empty Hashtable. All of its methods operate around the threshold set by the user (which must be done before calling any other methods). Also, the key length must also be set in order for the driver program to read license plates from provided files. We add or remove one element at a time when operating on the instance of SmartAR. Whenever the SmartAR’s number of elements <= the threshold set by the user, adding new key-value pairs will cause them to be appended to the front(head) of the doubly linked list of the sequence. If ever the element to be added causes the number of elements in the Sequence to go above the threshold, all the elements (key-value pairs) are deleted from the Sequence and are relocated appropriately (hashed) into the empty Hashtable. This is also consistent if removing an element will cause the number of elements inside SmartAR to go below the threshold. In such case, all elements would be deleted from the Hashtable and would be transferred into the Sequence. All other operations/methods that are applicable to a single entry operates in this fashion. That is, depending on which of the two ADTs are used, the corresponding method defined in each individual class will be called. Moreover, in each of the two classes (Sequence & Hashtable, an ArrayList is kept to dynamically keep track of the sorted keys currently present. The choice of using a Hashtable is so that we can add, delete, or search in O(1) when our input size becomes very large. This is compromised by the fact that a lot of memory has to be allocated overhead due to the nature of the load factor. On the contrary, using a slower algorithm is a good trade off with less overhead memory when operating with a smaller input size.

smartar's People

Contributors

kzhligh 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.