YouTip LogoYouTip

Data Structures - Hash Tables and Trees

Hash Tables

// JavaScript Map
let map = new Map();
map.set("name", "Alice");
map.get("name");  // "Alice"

// Python dict
d = {"name": "Alice", "age": 25}

Trees

class TreeNode {
    constructor(val) {
        this.val = val;
        this.left = null;
        this.right = null;
    }
}

Summary

  • Hash tables provide O(1) average lookup
  • Trees are hierarchical data structures
← RESTful API Design PrinciplesData Structures - Arrays and L β†’