Algorithm that return the keys by depth in an array has been implemented