You want to sort a sequence of values, right? If you pass a int
is only passing one value.
If you create a sequence of values somewhere you can just pass the address of where the sequence is, and the algorithm can access those values and do what it needs in each of the elements.
You may be asking why not go through the whole sequence. It is probably too large to copy everything from one place to another, which has no need to do this.
You have a question that talks about the practical use of the pointer .
The main problem of the insertion classification algorithm is that it has quadratic complexity (O (N2)) in the worst case. So for only 1000 elements in reverse order he has to do 1 million copies of data operations, that is tragic. But in small volumes this is not shocking and by maintaining reference locale the cache is much more efficient and can be faster than algorithms that make fewer copies but need to compare more or that comparisons cost more, or need more memory.