A2 COMP3 Algorithms