Giter Club home page Giter Club logo

thumbtack_app's Introduction

This program is a response to thumbtack.com/challenges (number 3) Acceptable Commands: SET [name] [value]: Set a variable [name] to the value [value]. Neither variable names or values will ever contain spaces. GET [name]: Print out the value stored under the variable [name]. Print NULL if that variable name hasn't been set. UNSET [name]: Unset the variable [name] END: Exit the program

BEGIN: Open a transactional block ROLLBACK: Rollback all of the commands from the most recent transaction block. If no transactional block is open, print out INVALID ROLLBACK COMMIT: Permanently store all of the operations from any presently open transactional blocks

tack.c is the primary database program ("tack" taken from the name Thumbtack)

hash.c and stack.c are implementations of a hash table and stack respectively

data.c provides an interface that makes hash.c and stack.c scaleable

Makefile:

  • "make" compiles everything
  • "make run" compiles and starts the database, which takes commands until "END"

Note: MAX_LEN defined in tack.c defines the maximum length (in characters) of a variable name (and also the maximum number of characters to be interpreted as part of the value). Longer inputs will be truncated. Choosing a number greater than 9 means that the value might not be storeable in an int. Appropriate changes should be made (atol, store to long).

When using for a large database, it would probably be best to choose an INIT_SIZE in hash.h that is prime and approximately double the expected number of elements.

Using a table of successive primes (each approximately double the previous) for growing the table would also be useful for scaling, since the present implementation just doubles the hash_table size, which means that the size is no longer prime.

thumbtack_app's People

Contributors

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