Implement freelist cache for BFS arrays

This was recommended by the instructors. Should save time reinitializing
the number-of-verticies-lengthed arrays but just reinitializing those
entries that have changed.
Change tracking now done with linked list instead of hash set

Tracking the changed elements of the cached arrays with a hashset creates
its own array-initialization overhead, especially with frequent clearing.
Doing it with a queue reduces memory allocation overhead to just the number
of elements being added to the set. Also it's safe to use a set because in
the BFS implementation, numbers are only added to the changeset when they
are not already marked by BFS. BFS is designed only to visit each node
once.
Fix dumb errors caught by compiler