Sorting algorithm that moves element to a 2-dimensional array
What you have come up with is a sligthly less memory efficient version of counting sort. 

This algorithm works in $\mathcal{O}(n + range)$ time where $n$ is the number of elements in the vector $unsorted$ and $max$ and $min$ are as defined in your program.

Your implementation uses $\mathcal{O}(n + range)$ memory. You can make it more memory efficient by just keeping track of how many times the same number in the vector 'unsorted' occurs rather than maintaining a vector with repeated instances of the same element i.e.

vector&lt;int&gt; presorted(range+1);
for(int i = 0; i &lt; unsorted.size(); i++)
     presorted[unsorted[i] - min]++


It will now use only $\mathcal{O}(range)$ memory.

Yes you are correct, this method might potentially use up a lot of memory if the difference between the smallest and largest elements of the vector is too great.

For those who are not fluent in C++:


OP is finding the smallest and largest elements of the unsorted array $max$ and $min$ respectively. 
He is initializing an array of size $max - min$ and creating an empty linked list in each position of the array (in this code it is the vector of vector of integers $presorted$). 
Then each element of $unsorted$ is added as a new node in the linked list at $presorted[unsorted[i] - min]$. In a random access computational model this operation will take $\mathcal{O}(1)$ time and hence each element of $unsorted$ is added to its appropriate bucket in constant time.
Then he is just iterating in the array of linked lists and compressing it to the final array $sorted$ which is the final output.