I was comparing the original Fisher-Yates shuffle vs the modern Fisher-Yates shuffle.
This reduces the algorithm's time complexity to O(n), compared to O(n2) for the naive implementation.
Ok I cannot understand how is it that we have n2 for the original algorithm.
You see, our first trip is to write out the random numbers. So that's 1N. and then the second step is to write out the elements based on the N. so that's 2N total?
Or is it like something to do with the second step takes longer so it's more N ?
The crucial difference between the two algorithms is described in the sentence before the one you quoted:
This allows you to use the random numbers directly as indices into an array, which takes only constant time per selection, and thus $O(n)$ in total; whereas if you leave the array unchanged, or if you use a linked list and unlink the used elements, you have to count through to the selected numbers, which takes $O(n)$ time per selection, and thus $O(n^2)$ in total.