-
You don't need recSelSort() and your swap() is misplaced. swap() belongs inside recFindMin() and selSort() should be used to move the min element forward but instead you're decrementing it.
Code:
selSort(array,i-1,length); /* i will never reach length which is the top level condition */
-
ok ill try to implement it
-
IMO the only functions you need to get the entire job done using only recursion are listed below with minor changes as in
Code:
void selSort(int array[], int i ,int length);
void swap(int num[],int i,int j);
int recFindMin(int array[], int index, int length);
selSort() is the top level function; its index i increments while length remains the same.
In recFindMin() index i remains the same while length decrements.
-
In case you are interested here's a pretty good guide to recursion http://faq.cprogramming.com/cgi-bin/...&id=1073086407
Any luck nailing down the current recursion sort?
-
-
Quote:
Originally Posted by
transgalactic2
i solved it :)
just curious to see what the final solution looks like?