算法草稿
代码实现
/* head 和 tail 的指针的排序的时候,都有可能发生变化,所以这里使用二级指针 */
int quickSortDoubList(st_doubNode** phead, st_doubNode ** ptail){
if(NULL == phead || NULL == *phead || NULL == ptail || NULL == *ptail){
printf("%s: param error\n",__func__);
return PARAM_ERR;
}
st_doubNode * head = NULL;
st_doubNode * tail = NULL;
st_doubNode * p = NULL;
st_doubNode * mov = NULL;
st_doubNode * prev = NULL;
st_doubNode * next = NULL;
st_doubNode * pivotpos = NULL;
int pivot = 0;
head = *phead;
tail = *ptail;
/*迭代退出的条件, 只有一个元素,或者没有元素*/
if(head == tail)
{
printf("\t exit resc head = %d \n", head->data);
return SUCCESS;
}
pivotpos = head;
pivot = pivotpos->data;
p