Git Product home page Git Product logo

trie-exercise's Introduction

Trie Miniproject: Trieing Wikipedia

Wikipedia needs autocompletion, and you're up!

Prerequisites:

  • Javascript with Prototypes
  • Backbone
  • Basic recursive data structures

Setup:

bundle install

Then to run the ruby sinatra app:

bundle exec ruby app.rb

The Root of the Matter:

Your project this weekend is to use your knowledge of recursive data structures, backbone, and javascript to make an autocompletion engine. I've included in this repo a selection of titles of wikipedia articles. You will write a frontend to display an input field to the user and as the user types letters, you will display to them all of the possible completions of their query. I've set up code which will automatically retrieve the dataset specified on line 16 of app.rb and add it to an Autocompleter object in the browser. You will also write a Trie-based backend for this Autocompleter object to replace the current, inefficient, array implementation. When you're writing your Trie, you can put autocompleter.js into Trie mode by swapping the sets of lines which are commented out.

The Trie:

A Trie is a tree which stores strings as paths through the tree. The following trie contains the words: ace, aced, aces, acre, acres, act, acts, acted, acting.

Trie Diagram

I've provided fairly comprehensive specs which you can run with rake jasmine.

Sample data sets to trie:

  • mini_titles contains 535 lines
  • tiny_titles contains 55635 lines
  • petite_titles contains 200000 lines
  • small_titles contains 744026 lines.

The full dataset, not included here, is about 70MB and 4 million lines.

Bonus:

  • Paginate the autocompleter results.
  • Modify your Trie to only create nodes at branches. Example: Trie Diagram

I have a spec for this compressed trie behavior here: https://gist.github.com/rsofaer/9418331

Resources:

http://en.wikipedia.org/wiki/Trie

Trie your best!

trie-exercise's People

Contributors

rsofaer avatar zealoushacker avatar kevinrogerteng avatar aikalima avatar

Watchers

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