Skip to content

phara0hcom/learAlgorithms

Repository files navigation

How to best solve a problem:

  • Understand the problem (Put it in your own words)
  • Explore concert examples (what is the input, what is the out put, edge cases)
  • Break it down (Write sudo code of the steps)
    • Devise a plan
  • Solve and Simplify Solve the things know how to solve first then tackle the harder steps
  • Look back and refactor

UNDERSTAND THE PROBLEM

  1. Can I restate the problem in my own words?
  2. What are the inputs that go into the problem?
  3. What are the outputs that should come from the solution to the problem?
  4. Can the outputs be determined from the inputs? In other words, do I have enough information to solve the problem? (You may not be able to answer this question until you set about solving the problem. That's okay; it's still worth considering the question at this early stage.)
  5. How should I label the important pieces of data that are a part of the problem?

EXPLORE EXAMPLES

  • Start with Simple Examples
  • Progress to More Complex Examples
  • Explore Examples with Empty Inputs
  • Explore Examples with Invalid Inputs

BREAK IT DOWN

Explicitly write out the steps you need to take.

This forces you to think about the code you'll write before you write it, and helps you catch any lingering conceptual issues or misunderstandings before you dive in and have to worry about details (e.g. language syntax) as well.

SIMPLIFY

Find the core difficulty in what you're trying to do Temporarily ignore that difficulty Write a simplified solution Then incorporate that difficulty back in

REFACTORING QUESTIONS

  • Can you check the result?
  • Can you derive the result differently?
  • Can you understand it at a glance?
  • Can you use the result or method for some other problem?
  • Can you improve the performance of your solution?
  • Can you think of other ways to refactor?
  • How have other people solved this problem?

About

Javascript algorithms

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published