Brute-force black-box group algorithm for abelianness testing

Idea and outline
The idea is simple: for every pair $$\{x,y \}$$ of elements of $$G$$, compute the products $$xy$$ and $$yx$$ and check whether they are equal.

Analysis of running time
The number of pairs is $$O(N^2)$$ and we assume that traversal of the pairs does not change the order of magnitude. The cost of checking each pair is twice the cost of multiplication plus the cost of equality checking. With the log-size assumption, these are all polynomial in $$\log_2N$$, so we get $$O(N^2(\log_2N)^r)$$ as the total time for the algorithm.