↩ revert:
This commit is contained in:
@@ -3,9 +3,9 @@
|
||||
|
||||
#include "list.h"
|
||||
|
||||
list* list_create( )
|
||||
list *list_create( )
|
||||
{
|
||||
list* me;
|
||||
list *me;
|
||||
me = malloc(sizeof(*me));
|
||||
if (NULL == me)
|
||||
return NULL;
|
||||
@@ -16,7 +16,7 @@ list* list_create( )
|
||||
}
|
||||
|
||||
// 从第一个有效节点作为第0个
|
||||
int list_insert_at(list* me, int i, datatype* data)
|
||||
int list_insert_at(list *me, int i, datatype *data)
|
||||
{
|
||||
int k = 0;
|
||||
list *node = me, *newnode;
|
||||
@@ -50,7 +50,7 @@ int list_insert_at(list* me, int i, datatype* data)
|
||||
}
|
||||
|
||||
// 有序插入
|
||||
int list_order_insert(list* me, datatype* data)
|
||||
int list_order_insert(list *me, datatype *data)
|
||||
{
|
||||
list *p = me, *q;
|
||||
|
||||
@@ -68,7 +68,7 @@ int list_order_insert(list* me, datatype* data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int list_delete_at(list* me, int i, datatype* data)
|
||||
int list_delete_at(list *me, int i, datatype *data)
|
||||
{
|
||||
int k = 0;
|
||||
list *p = me, *q;
|
||||
@@ -98,7 +98,7 @@ int list_delete_at(list* me, int i, datatype* data)
|
||||
return -2;
|
||||
}
|
||||
|
||||
int list_delete(list* me, datatype* data)
|
||||
int list_delete(list *me, datatype *data)
|
||||
{
|
||||
list *p = me, *q;
|
||||
while (p->next && p->next->data != *data)
|
||||
@@ -117,16 +117,16 @@ int list_delete(list* me, datatype* data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int list_isempty(list* me)
|
||||
int list_isempty(list *me)
|
||||
{
|
||||
if (NULL == me->next)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void list_display(list* me)
|
||||
void list_display(list *me)
|
||||
{
|
||||
list* node = me->next;
|
||||
list *node = me->next;
|
||||
if (0 == list_isempty(me))
|
||||
return;
|
||||
|
||||
@@ -140,7 +140,7 @@ void list_display(list* me)
|
||||
return;
|
||||
}
|
||||
|
||||
void list_destroy(list* me)
|
||||
void list_destroy(list *me)
|
||||
{
|
||||
list *node, *next;
|
||||
|
||||
|
||||
@@ -6,21 +6,21 @@ typedef int datatype;
|
||||
typedef struct node_st
|
||||
{
|
||||
datatype data;
|
||||
struct node_st* next;
|
||||
struct node_st *next;
|
||||
} list;
|
||||
|
||||
list* list_create( );
|
||||
list *list_create( );
|
||||
|
||||
int list_insert_at(list* me, int i, datatype* data);
|
||||
int list_order_insert(list* me, datatype* data);
|
||||
int list_insert_at(list *me, int i, datatype *data);
|
||||
int list_order_insert(list *me, datatype *data);
|
||||
|
||||
int list_delete_at(list* me, int i, datatype* data);
|
||||
int list_delete(list* me, datatype* data);
|
||||
int list_delete_at(list *me, int i, datatype *data);
|
||||
int list_delete(list *me, datatype *data);
|
||||
|
||||
int list_isempty(list* me);
|
||||
int list_isempty(list *me);
|
||||
|
||||
void list_display(list* me);
|
||||
void list_destroy(list* me);
|
||||
void list_display(list *me);
|
||||
void list_destroy(list *me);
|
||||
|
||||
|
||||
#endif
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
int main( )
|
||||
{
|
||||
list* l;
|
||||
list *l;
|
||||
datatype arr[] = {12, 9, 23, 2, 34, 6, 45};
|
||||
|
||||
l = list_create( );
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
typedef struct node_st
|
||||
{
|
||||
int data;
|
||||
struct node_st* next;
|
||||
struct node_st *next;
|
||||
} list;
|
||||
|
||||
// try something
|
||||
@@ -32,7 +32,7 @@ list *jose_create(int a[], int n)
|
||||
}
|
||||
#endif
|
||||
|
||||
list* jose_create(int n)
|
||||
list *jose_create(int n)
|
||||
{
|
||||
list *me, *newnode, *cur;
|
||||
int i = 1;
|
||||
@@ -61,9 +61,9 @@ list* jose_create(int n)
|
||||
return me;
|
||||
}
|
||||
|
||||
void jose_show(list* me)
|
||||
void jose_show(list *me)
|
||||
{
|
||||
list* list;
|
||||
list *list;
|
||||
|
||||
for (list = me; list->next != me; list = list->next)
|
||||
{
|
||||
@@ -74,7 +74,7 @@ void jose_show(list* me)
|
||||
printf("%d\n", list->data);
|
||||
}
|
||||
|
||||
void jose_kill(list** me, int n)
|
||||
void jose_kill(list **me, int n)
|
||||
{
|
||||
list *cur = *me, *node;
|
||||
int i = 1;
|
||||
@@ -103,7 +103,7 @@ void jose_kill(list** me, int n)
|
||||
|
||||
int main( )
|
||||
{
|
||||
list* list;
|
||||
list *list;
|
||||
|
||||
list = jose_create(JOSE_NUM);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
int main( )
|
||||
{
|
||||
int i, ret;
|
||||
struct node_st* list = NULL;
|
||||
struct node_st *list = NULL;
|
||||
struct score_st tmp;
|
||||
|
||||
for (i = 0; i < 7; i++)
|
||||
@@ -28,7 +28,7 @@ int main( )
|
||||
printf("\n\n");
|
||||
|
||||
int id = 13;
|
||||
struct score_st* ptr;
|
||||
struct score_st *ptr;
|
||||
ptr = list_find(&list, id);
|
||||
if (NULL == ptr)
|
||||
printf("Can not find!\n");
|
||||
|
||||
@@ -21,9 +21,9 @@ struct node_st *list_insert(struct node_st *list, struct score_st *data)
|
||||
}
|
||||
#endif
|
||||
|
||||
int list_insert(struct node_st** list, struct score_st* data)
|
||||
int list_insert(struct node_st **list, struct score_st *data)
|
||||
{
|
||||
struct node_st* new;
|
||||
struct node_st *new;
|
||||
|
||||
new = malloc(sizeof(*new));
|
||||
if (NULL == new)
|
||||
@@ -36,9 +36,9 @@ int list_insert(struct node_st** list, struct score_st* data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void list_show(struct node_st* list)
|
||||
void list_show(struct node_st *list)
|
||||
{
|
||||
struct node_st* cur;
|
||||
struct node_st *cur;
|
||||
|
||||
for (cur = list; NULL != cur; cur = cur->next)
|
||||
{
|
||||
@@ -51,9 +51,9 @@ void list_show(struct node_st* list)
|
||||
}
|
||||
|
||||
// 删除首位
|
||||
int list_delete(struct node_st** list)
|
||||
int list_delete(struct node_st **list)
|
||||
{
|
||||
struct node_st* cur;
|
||||
struct node_st *cur;
|
||||
|
||||
if (NULL == *list)
|
||||
return -1;
|
||||
@@ -66,9 +66,9 @@ int list_delete(struct node_st** list)
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct score_st* list_find(struct node_st** list, int id)
|
||||
struct score_st *list_find(struct node_st **list, int id)
|
||||
{
|
||||
struct node_st* cur;
|
||||
struct node_st *cur;
|
||||
|
||||
if (NULL == *list)
|
||||
return NULL;
|
||||
@@ -91,9 +91,9 @@ struct score_st* list_find(struct node_st** list, int id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int list_destroy(struct node_st** list)
|
||||
int list_destroy(struct node_st **list)
|
||||
{
|
||||
struct node_st* cur;
|
||||
struct node_st *cur;
|
||||
|
||||
if (NULL == list)
|
||||
return -1;
|
||||
|
||||
@@ -11,16 +11,16 @@ struct score_st
|
||||
struct node_st
|
||||
{
|
||||
struct score_st data;
|
||||
struct node_st* next;
|
||||
struct node_st *next;
|
||||
};
|
||||
|
||||
// struct node_st *list_insert(struct node_st *list, struct score_st *data);
|
||||
int list_insert(struct node_st** list, struct score_st* data);
|
||||
int list_insert(struct node_st **list, struct score_st *data);
|
||||
|
||||
void list_show(struct node_st* list);
|
||||
void list_show(struct node_st *list);
|
||||
|
||||
int list_delete(struct node_st** list);
|
||||
int list_delete(struct node_st **list);
|
||||
|
||||
struct score_st* list_find(struct node_st** list, int id);
|
||||
struct score_st *list_find(struct node_st **list, int id);
|
||||
|
||||
int list_destroy(struct node_st** list);
|
||||
int list_destroy(struct node_st **list);
|
||||
|
||||
@@ -5,10 +5,10 @@ typedef struct node_st
|
||||
{
|
||||
int coef;
|
||||
int exp;
|
||||
struct node_st* next;
|
||||
struct node_st *next;
|
||||
} list;
|
||||
|
||||
list* poly_create(int a[][2], int n)
|
||||
list *poly_create(int a[][2], int n)
|
||||
{
|
||||
list *me, *newnode, *cur;
|
||||
|
||||
@@ -36,9 +36,9 @@ list* poly_create(int a[][2], int n)
|
||||
return me;
|
||||
}
|
||||
|
||||
void poly_show(list* me)
|
||||
void poly_show(list *me)
|
||||
{
|
||||
list* cur;
|
||||
list *cur;
|
||||
|
||||
for (cur = me->next; NULL != cur; cur = cur->next)
|
||||
{
|
||||
@@ -47,7 +47,7 @@ void poly_show(list* me)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void poly_union(list* p1, list* p2)
|
||||
void poly_union(list *p1, list *p2)
|
||||
{
|
||||
list *p, *q, *r;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user