Coder Social home page Coder Social logo

acesonnall / grabbing-the-weather Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 4.45 MB

A program that prompts for a city and country name and returns the current temperature for the city using OpenWeatherMap API (Technical Interview Problem/Travis CI Practice)

JavaScript 41.45% CSS 49.68% HTML 8.87%
temperature weather openweathermap-api technical-coding-interview

grabbing-the-weather's People

Contributors

acesonnall avatar

Watchers

 avatar  avatar

Forkers

codealigned

grabbing-the-weather's Issues

Lowercase city cannot be found

If I enter "des moines" in the city field and "United States" in the country field, I get the message "Location not supported". The application should be able to find cities that are supplied in any case, i.e Des Moines, des moines, des Moines, dEs MOInes, etc

Implement Splay Tree for City ID Lookup

At the moment, the main component of the application -- the "getWeather()" function in routes.js has a worst-case time complexity of O(n) if we ignoring the time complexity of functions from imported packages. This is calculated from the for-loop on line 66 since, worst-case scenario, the loop will iterate through every entry in the JSON array.

To make the algorithm more efficient, the contents of the JSON array could be inserted into a self-adjusting binary search tree, or splay tree (amortized O(log n)) and then a value can be searched for in O(log n) time, making the worst-case time complexity of the "getWeather()" function O(log n) overall instead of O(n) as it is now. This is because a splay tree would allow for the most recently accessed elements to also be the quickest to access again. For a weather application, this would make sense since we can assume that cities with larger populations will be looking up the weather for their location very frequently and, thus, could easily benefit from the speed improvements provided by a splay tree.

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.