joshsaintjacque / fundamentals

A collection of solutions to fundamental computer science challenges.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Comp Sci Fundamentals

A collection of solutions to common computer science challenges found online, in books, online, or elsewhere.

My intention to is follow a process for methodically walking through each challenge and record the process the same way I would if I were whiteboarding it. Many challenges will include initially sub-optimal solutions and will be built upon with (hopefully) more performant and elegant code as I learn.

Solutions will be implemented in multiple languages, beginning with Ruby, Javascript, and C#.

Process

I will be roughly following the process for walking through a process introduced by Gayle Laakmann McDowell in Cracking the Coding Interview. In summary, the process looks like this:

  1. Listen

    Pay very close attention to any information in the problem description.

    In this case, I'll simply be restating the problem with emphasis on any pieces of information I believe will be important to solving the problem.

  2. Example

    Pretty strait-forward. Before tackling the problem I'll provide (or use a provided) example input and expected output. Examples should be big enough and main-case enough to test the validity of any solution.

  3. Brute Force

    Get a brute force solution as soon as possible.

    Outline a solution in English or pseudo-code, we won't worry about efficiency at this point.

  4. Optimize

    Walk through the brute force solution and look for ways to improve its efficiency. How does the current performance compare to the best conceivable runtime? Are there potential tradeoffs between time and space?

  5. Walk Through

    Now that you have an optimal solution, walk through your approach in detail.

  6. Implement

    The first five steps will only be walked through once, however this and the next step will be done separately for each language. I'll be writing the code in the markdown, without aid of an IDE in order to simulate a whiteboard. Expect typos/errors, but my goal is to write code that compiles as-is.

  7. Test

    Step through the algorithm with the example, fix any errors that are found.

Collections

License

MIT License

Copyright (c) 2017 Josh Saint Jacque

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

A collection of solutions to fundamental computer science challenges.