2025-03-25 18:09:23 +08:00
|
|
|
|
#ifndef LINKED_LIST_H
|
|
|
|
|
#define LINKED_LIST_H
|
|
|
|
|
#define elem_type int
|
|
|
|
|
|
|
|
|
|
typedef struct node
|
|
|
|
|
{
|
|
|
|
|
elem_type value;
|
|
|
|
|
struct node* next;
|
|
|
|
|
} node;
|
|
|
|
|
|
|
|
|
|
typedef struct address_node
|
|
|
|
|
{
|
|
|
|
|
int n;
|
2025-03-28 10:42:19 +08:00
|
|
|
|
elem_type * p;
|
2025-03-25 18:09:23 +08:00
|
|
|
|
}address_node;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ʼ<EFBFBD><CABC><EFBFBD>ڵ<EFBFBD>
|
|
|
|
|
node* init_node(elem_type value);
|
|
|
|
|
|
|
|
|
|
// ɾ<><C9BE><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ڵ<EFBFBD>
|
|
|
|
|
void delete_node(node* n);
|
|
|
|
|
|
|
|
|
|
// <20>滻<EFBFBD>ڵ<EFBFBD>
|
|
|
|
|
void replace_node (node* n, elem_type value);
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>
|
2025-03-28 10:42:19 +08:00
|
|
|
|
void insert_node(node* head,node *new_node);
|
2025-03-25 18:09:23 +08:00
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>ʽڵ<CABD>
|
|
|
|
|
int get_node(node* n);
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>
|
|
|
|
|
address_node *find_node(node* head, elem_type value);
|
|
|
|
|
|
|
|
|
|
// <20><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>
|
|
|
|
|
void print_node_list(node* head);
|
|
|
|
|
|
2025-03-28 10:42:19 +08:00
|
|
|
|
// get length of linked list
|
|
|
|
|
int get_node_list(node* head);
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>
|
|
|
|
|
elem_type get_node_value(node* head,int pos);
|
|
|
|
|
|
2025-03-25 18:09:23 +08:00
|
|
|
|
#endif
|
|
|
|
|
|