Git Product home page Git Product logo

learnprefixtrees's Introduction

LearnPrefixTrees

A testing-driven approach to learning how to implement Prefix Trees in JavaScript.

Why should I use this?

If you want to learn how to make a prefix tree, of course! This repo uses a test running html document, SpecRunner.html, to double check your work and (hopefully) guide you through the process of creating your own prefix tree in javascript. This learning style has been unabashedly stolen from Hack Reactor, where I am currently a student, and from Adam Van Antwerp that is currenlty shepherding us at Hack Reactor. Thanks for being awesome Hack Reactor! and Thanks for being awesome Adam! The idea of releasing this repo has been givien to me by Evan Hackett, our Tech HD at Hack reactor. Thanks for such amazing support Evan!

Prefix Tree, also known as Trie, are fascinating data structures for storing strings or other sequences in a way that allows for a fast look-up. For the sake of the excercise we aim to implement a prefixTree that can handle autocomplete for T9-style texting. For more information on this check out my blog post , where I give an explanation on their structure and outline some instances where a developer may find them useful. If you find that this not enough information to fully implement a PrefixTree, feel free to drop me a line and request some clarification and I'll do my best to update the post with the new details.

How do I use this repo?

First of all, fork this repo and clone it to your local machine (or just simply clone it directly if you don't want to use git to keep track of your progress). Open up SpecRunner.html in a browser and initially you're going to see a lot of red. These are your failing tests that you should make pass!

Failing SpecRunner

These tests require you to create a Prefix Tree object using the well used pseudo-classical instantiation pattern. If this doesn't appeal to you, feel free to fork my repo and make one with tests assuming a different pattern. All of the work you need to do is within the src/prefixTree.js file.

Keep working to meet the specified tests. If you need more clarification on what the tests are looking for, click on the specific requirement in SpecRunner.html and it will show you the mocha tests that need to pass.

Expanded requirement

Keep coding away and you'll start to see some green. Eventually you'll have a SpecRunner.html that looks like this:

Passing tests

and then you should have successfully implemented a a prefixTree !

learnprefixtrees's People

Contributors

nickbalestra avatar

Watchers

James Cloos avatar Allan Trinh 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.