Binary Trees

Algorithms

Huffman Coding

Given a set of characters and their corresponding frequencies of occurrence, produce Huffman codes for each character such that the average code length is minimised. Return the average code length.

Read
Algorithms

Querying Range Sums (2D)

Design a matrix-like data structure that allows you to update elements and query submatrix sums efficiently.

Read
Algorithms

Querying Range Sums

Design an array-like data structure that allows you to update elements and query subarray sums efficiently.

Read
Algorithms

Merging Binary Search Trees

Merge two binary search trees into a single binary search tree.

Read
Algorithms

Binary Tree Path Sums

You are given a binary tree in which each node contains an integer value. Find the number of paths that sum to a given value. The path does not need to start or end at the root or a leaf.

Read