Introduction
Data Structures¶
程序的基本单元,算法的基础。
- Linked List
 - Doubly Linked List
 - Queue
 - Stack
 - Hash Table
 - Heap - max and min heap versions
 - Priority Queue
 - Trie
 - Tree
- Binary Search Tree
 - AVL Tree
 - Red-Black Tree
 - Segment Tree - with min/max/sum range queries examples
 - Fenwick Tree (Binary Indexed Tree)
 
 - Graph (both directed and undirected)
 - Disjoint Set
 - Bloom Filter
 
Utils¶
- /utils/Comparator.js
 
export default class Comparator {
  constructor(compareFunction) {
    this.compare = compareFunction || Comparator.defaultCompareFunction;
  }
  static defaultCompareFunction(a, b) {
    if (a === b) {
      return 0;
    }
    return a < b ? -1 : 1;
  }
  equal(a, b) {
    return this.compare(a, b) === 0;
  }
  greaterThan(a, b) {
    return this.compare(a, b) > 0;
  }
  lessThan(a, b) {
    return this.compare(a, b) < 0;
  }
  greaterThanOrEqual(a, b) {
    return this.greaterThan(a, b) || this.equal(a, b);
  }
  lessThanOrEqual(a, b) {
    return this.lessThan(a, b) || this.equal(a, b);
  }
}