跳转至

Greedy

Activity Selection Problem

题目描述

给定n条线段,选取最大的集合,使得集合中的线段两两不相交。

Solution

选取最先结束的线段

Huffman's Algorithm

definition

Every time pop two minist nodes from the heap, and add them to the tree with the new merging node push into the heap, until the heap is empty.

example