The Ultimate Guide to JavaScript Algorithms: Structure and Setup

Publikováno: 23.1.2019

It's about time for us to dive into the core content of this course. I can tell you’re fired up already! To help you follow along better, let us now examine the course structure as well as set up o...

Celý článek

It's about time for us to dive into the core content of this course. I can tell you’re fired up already! To help you follow along better, let us now examine the course structure as well as set up our development environment appropriately.

How this Course is Structured?

The Content

The algorithms and data structures covered in this course are organized in three levels:

  • Beginner
  • Intermediate
  • Advanced

This will ensure that we build up on previous knowledge, thus making it easier to digest the slightly complex content when we get to them. No need to quake with fear.

Don't feel discouraged if some of these challenges are a little difficult, working through projects that we don't know at first, leads us to become better developers.

Make sure to have fun while at it!

Every article from this point will sufficiently explain one algorithm or data structure at a time, consider various implementations and test for efficiency under the following sections:

  • The Challenge Here, we will introduce the problem and provide some premise to show it’s relevance to a software engineer.
  • Algorithmic Thinking In this section, we will analyze the challenge extensively and explain what the solution would look like in very simple terms.
  • Code Implementation(s) Next, we get technical and come up with various solutions in JavaScript, with each implementation fully explained.
  • Testing Here, we’ll check if the algorithms pass with Jest and do a performance comparison to identify the most optimal solution.
  • Practical Application(s) As one of the main reasons for this course is to help you apply the knowledge acquired to the real world, we will highlight cases where you might encounter the challenge considered.
  • Conclusion This is a summary of the entire article and highlight of the main points.
  • Further Reading At the end of every article, you'll find helpful links to reliable content on the subject considered. This is to help you learn more, beyond the scope of this course.

The Code

All the code for this course can be found in this repository. Each algorithm and data structure will have it's own folder and in there you would find 3 files.

  • index-START.js This is an empty/skeletal file where you can write your own algorithms and test them out as you follow along with the course.
  • index-SOLUTION.js In here, you would find all the solutions for a particular challenge as discussed in the article.
  • test.js You would never have to edit this file. It contains the tests with which we would validate our algorithms to see if they pass for every case specified in there.

How to Run Tests

To run the tests for each algorithm in this course, open up your terminal and navigate to the root directory of the course codebase . Once inside, run the command below:

npm run test <folder name>

This will run the tests and present you with a result as in the image below which will tell you these three things:

  • how many cases passed
  • how many failed
  • and how many seconds it took to execute.

If you aren't very experienced with running these tests, do not feel weary. This is optional. However, we would highlight the results in every case so you still get to learn from them.

Setting Up

You can set up your development environment for this course in the following steps.

Install Node

To check if Node is already installed and running on your system, run the command below from your terminal(command line for windows):

node -v

If Node is already installed on your computer, this command will return the version that you are running currently. Otherwise, you can install it here.

Clone the Repository

Open up your terminal (Command line on Windows) and run this command:

git clone <repository url>

This would create a copy of the repository on your computer. We would have to update this local copy from time to time. To update your local copy with new changes and additions at anytime, simply run the command below:

git pull

This command will download and update your local copy in a few seconds. If you would prefer to download the repository manually, you can do so here.

Install Dependencies

From your terminal, navigate into the project directory by running the following command:

cd <folder name>

Once inside, run the command npm install to download and install project dependencies and wait for the process to complete. On completion, open the course folder in your code editor of choice.

That’s it! We are all set up now.

How to take this Course

There are various ways you could take this course. You could:

  • Simply read through and hope it’ll stick somehow (Please don’t do this ????).
  • Go through the content of each article and practice after.
  • You could practice as you read through and ensure you are getting similar results.

Here’s what would help you get the best out of this course.

What we Recommend

  • Practice every algorithm considered on your own as you go through this course.
  • Do not copy code. Write it out yourself. The only way to learn to code is to actually write code. You get better that way.
  • Read up linked articles. These are intentionally linked to help you gain a better understanding of the subject matter.
  • Provide feedback. The comment section exists for this purpose. Ask questions, make suggestions, air observations and so on.
  • Try more solutions. Often times there would be more ways to solve the discussed challenge. Make sure to come up with your own solutions. Try out methods and share them here too.

See you in the next section!

Nahoru
Tento web používá k poskytování služeb a analýze návštěvnosti soubory cookie. Používáním tohoto webu s tímto souhlasíte. Další informace