So, I have a class where we've been handed an implementation of the quicksort algorithm in c code, and we have to make an implentation of that code in mips assembly language. I have succesfully made most of my code, but am having trouble with some of the recursion. This is the part of the c program that i'm concerned about:
...
tmp = v[left];
v[left] = v[last];
v[last] = tmp;
qsort(v, left, last-1);
qsort(v, last+1, right);
The part i'm having trouble with, is the recursive part, ie. qsort(v, left, last-1)...
My question is, when qsort(v, left, last-1) is run, the value last-1 is saved as "right". So when that recursive call is done, I have to recall the previous value(s) of "right". How could I do that, simply?
Edit: the problem is, the bigger the list of numbers is, the more recursive calls there'll be, and as such, the more values i have to store. I guess, what I want to know, is if there's a way to store and recall a variable length of values?