Algorithms

The A in DSA



When applicable

I will pretend that javascript actually has arrays.

  • I only have access to the .length property of an array.
    • no i wont go full c neckbeard and require length to be passed in.














Its a very good practice to get into is being able to visualize the problem, discuss it with boxes and arrows, and then program it. Its definitely a core competency that will follow you for life.





























As I said, lets whiteboard this.















What's the Big O?

Lets ask this question always before we proceed



Important concepts

  1. growth is with respect to the input
  2. Constants are dropped
  3. Worst case is usually the way we measure














Lets implement it

To follow along i recommend using my kata typescript library

Kata

git clone git@github.com:ThePrimeagen/kata-machine.git
cd kata-machine
yarn install
yarn generate
vim $(yarn -s day) # or navigate to day1 folder

Yes this will help you by giving you a simple way to do Katas!



Ok! To the typescripts!