Code Monkey home page Code Monkey logo

workshop-periodic-table's Introduction

Periodic Table Speller

This workshop project explores the algorithmic complexities (speed and memory) of checking if an input word can be "spelled" (case-insensitive) by a sequence of the chemical symbol abbreviations from the standard periodic table.

Periodic Table

For example, the word "accept" can be spelled with Ac (Actinium) + Ce (Cerium) + Pt (Platinum).

The goal of this tool is to check if an input word can be "spelled" with the periodic table symbols, and then to show that sequence of element symbols.

Workshop Instructions

  1. Check out the start-here branch.

  2. Consult the app.js module for the app logic already implemented:

    • Calls Speller.check(..) to attempt to spell an input word with the periodic table element symbols.

    • Calls Speller.lookup(..) to pull the periodic table element by its symbol (case-insensitive).

    • Note also the list of known test words in code comments. You'll want to use these as you test your solution!

  3. Now consult the speller.js module for the algorithm logic to be implemented (look for the TODO comments):

    • The loadPeriodicTable() function loads the periodic-table.json file into the elements variable.

    • The check(..) function accepts an input word as a string (all lowercase letters) and returns an array (empty array if word couldn't be spelled).

    • The lookup(..) function accepts a symbol (as a string) and returns the periodic table element's entry/info, used to render the spelling as periodic table elements.

  4. When you're ready, or if you get stuck in your own implementation, check out the option-1, option-2, and option-3 branches and compare your solution to the ones provided.

Acknowledgments

This workshop problem is similar to/inspired by ChemSpeller.

The JSON file holding periodic table elements was adapted from: https://github.com/Bowserinator/Periodic-Table-JSON/blob/master/PeriodicTableJSON.json

Workshop Resources

This repository is part of my "Thinking & Coding Algorithms" workshop, which has been presented at a number of public JS/web conferences, as well as for private corporate training engagements. In addition, it is included in my Frontend Masters course on algorithms and data structures.

Please note that as this material evolves/improves over time, there may be changes to the branch names (e.g., "Option-1", "Option-2b", etc) to make room for these changes while preserving (as much as possible) the repository state as presented in various different workshops. When that current state appears to have diverged, please consult the git commit history to access older versions of files/resources.

License

All code and documentation are (c) 2023 Kyle Simpson and released under the MIT License. A copy of the MIT License is also included.

workshop-periodic-table's People

Contributors

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