array complexity algorithms

Nice way to do this. Good job!