This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public class Dequeue<T> | |
{ | |
public Dequeue(int capacity) | |
{ | |
this.array = new T[capacity]; | |
} | |
public Dequeue() : this(5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
public class DisjointSet<T> | |
{ | |
Dictionary<T, T> parents = new Dictionary<T, T>(); | |
Dictionary<T, int> weights = new Dictionary<T, int>(); | |
public T Union(T a, T b) { | |
var aParent = Find(a); | |
var bParent = Find(b); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
public class Heap<T> | |
{ | |
List<T> a = new List<T>(); | |
Comparer<T> comparer; | |
public Heap(Comparer<T> comparer) | |
{ |