Skip to content

Sorting algorithms implemented in TS, with focus in unit testing and profiling.

License

Notifications You must be signed in to change notification settings

JCPedroza/sorting-algorithms-ts

Repository files navigation

Sorting Algorithms Implemented in TypeScript

typescript linux build & tests linting license MIT ts-standard

This is an exercise to study and practice:

  • TypeScript
  • Sorting algorithms
  • Unit testing
  • Profiling
  • Documenting
  • Version control
  • Continuous integration

Prompt

Implement, unit test, document, time profile, and memory profile different sorting algorithms.

Keep things simple!

  • Don't use dependencies unless absolutely necessary.
  • Create your own micro-frameworks for unit testing and profiling, if possible.

Install Dependencies

Multi-Platform

curl -fsSL https://bun.sh/install | bash # Bun
curl -fsSL https://deno.land/x/install/install.sh | sh # Deno
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash # NVM

Usage

Provided Scripts

You can use the provided scripts to run everything easily. One of the secondary goals of the exercise is to informally benchmark the runtime and memory usage of different runtimes, including:

  • Node
  • Bun
  • TS-Node
  • TSC + Node

The scripts directory is where this dynamic is centralized.

Running Unit Tests

POSIX Shell Scripts

For Unix, Linux, and MacOS, you can use the shell executable files.

./scripts/unit-tests-bun.sh # Run all unit tests with Bun
./scripts/unit-tests-ts-node.sh # Run all unit tests with TS-Node
./scripts/unit-tests-ts-tsc.sh # Transpile with TSC and run all unit tests with Node

Contribute

Pull requests and code reviews are always welcome!