solving big o notation problems - Search