Fixed.
This commit is contained in:
parent
9c51d27d1b
commit
16b326b177
@ -11,6 +11,15 @@
|
||||
*返回: 如果成功返回0,如果失败则返回-1.*/
|
||||
static int sortList(List *p_list, unsigned long long begin, unsigned long long end, int(*func)(Node *f_node, Node *s_node));
|
||||
|
||||
/**
|
||||
链表排序函数,该函数不直接对用户开放
|
||||
|
||||
@param p_list 指向需要操作的链表的指针
|
||||
@param begin 开始的节点的序号
|
||||
@param end 结束的节点的序号
|
||||
@param func 指向判断条件的函数的函数指针,接受两个指向相关节点的指针,比较他们的大小并返回正负值。
|
||||
@return 成功进行操作则返回0
|
||||
*/
|
||||
static int sortList(List *p_list, unsigned long long begin, unsigned long long end, int(*func)(Node *f_node, Node *s_node)){
|
||||
unsigned long long target_index = begin;
|
||||
register Node *t_node = findByIndexForNode(p_list, target_index);
|
||||
@ -41,6 +50,15 @@ static int sortList(List *p_list, unsigned long long begin, unsigned long long e
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
向用户开放的链表排序函数
|
||||
|
||||
@param p_list 指向需要操作的链表
|
||||
@param func 指向判断条件的函数的函数指针,接受两个指向相关节点的指针,比较他们的大小并返回正负值。
|
||||
@return 成功进行操作则返回0
|
||||
*/
|
||||
int sortListForCustom(List *p_list, int(*func)(Node *f_node, Node *s_node)){
|
||||
#ifdef list_quick_enable
|
||||
if(p_list->p_lq != NULL && !p_list->p_lq->if_sort) p_list->p_lq->if_sort = 1;
|
||||
|
13
test/test.c
13
test/test.c
@ -47,19 +47,6 @@ int list(void) {
|
||||
return 0;
|
||||
}*/
|
||||
|
||||
int stack(void) {
|
||||
int i;
|
||||
Stack *t_stack = initStack();
|
||||
for (i = 0; i < 10; i++) {
|
||||
pushStack(t_stack, snodeWithInt(i));
|
||||
}
|
||||
for (i = 0; i < 10; i++) {
|
||||
printf("%d", getValueByIntForSNode(popStack(t_stack)));
|
||||
}
|
||||
releaseStack(t_stack);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int time_avg(void){
|
||||
List *t_list = initList(0);
|
||||
int64_t time_all = 0;
|
||||
|
@ -9,10 +9,7 @@
|
||||
#include <list/list_expand.h>
|
||||
#include <list/list_expand_1.h>
|
||||
#include <list/list_quick.h>
|
||||
#include <stack/stack.h>
|
||||
#include <stack/stack_expand.h>
|
||||
//#include "tree/tree_expand.h"
|
||||
#include "communicate/communicate.h"
|
||||
#include <communicate/communicate.h>
|
||||
|
||||
int stack(void);
|
||||
int list(void);
|
||||
|
Loading…
Reference in New Issue
Block a user