Skip to content

MuckT/data-structures-and-algorithms

Repository files navigation

Data Structures and Algorithms

JavaScript Setup

Use Node.js LTS and Yarn (recommended) to install and run tests.

Node setup (optional, via nvm):

nvm install --lts
nvm use --lts
node -v

Install dependencies and run tests (Yarn):

cd <root>
yarn
yarn test

If Yarn is not available:

# Option A: use Corepack to activate the repo-pinned Yarn 1.x
corepack enable
corepack prepare [email protected] --activate

# Option B: install globally (classic Yarn)
npm i -g yarn

Using npm instead of Yarn:

npm ci
npm test

Handy commands:

  • Run a specific Jest test file: yarn test code-challenges/challenges-01.test.js
  • Lint JavaScript: yarn lint

Python Setup

Set up a local Python environment and run tests:

cd /Users/tomm/repos/data-structures-and-algorithms
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -U pip pytest
pytest --version

Run tests:

  • All Python challenges: pytest -q code-challenges
  • Single file: pytest -q code-challenges/challenges_01_test.py

Pytest test discovery:

  • Default patterns: test_*.py or *_test.py
  • If you prefer “.test.py” names, add a pytest.ini at the repo root:
    [pytest]
    python_files = *.test.py test_*.py *_test.py
    

301 Code Challenges (JavaScript)

forEach

array.map()

Filter

Sort

Reduce

Value vs. Reference

Array and String Methods

Regular Expressions part I

Object.keys, Object.values, and Object.entries

Two-dimensional arrays

Chaining Methods

Regular Expressions, part II

Includes, Every, Substring, charAt

Review

401 Data Structures, Code Challenges

Array Binary Search

Array Insert Shift

Hash Table

Linked List

Linked List Zip

Reverse Array

Stacks and Queues

Stack Queue Brackets

Stack Queue Pseudo

Binary Tree

Tree Intersection

Misc

JavaScript Folder Setup

About

A collection of code challenges

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published