2025-03-17 16:27:15 +08:00
|
|
|
|
#ifndef LINKED_LIST_H
|
|
|
|
|
#define LINKED_LIST_H
|
2025-03-21 13:07:47 +08:00
|
|
|
|
#define elem_type int
|
2025-03-17 16:27:15 +08:00
|
|
|
|
|
|
|
|
|
typedef struct node
|
|
|
|
|
{
|
2025-03-21 13:07:47 +08:00
|
|
|
|
elem_type value;
|
2025-03-17 16:27:15 +08:00
|
|
|
|
struct node* next;
|
|
|
|
|
} node;
|
|
|
|
|
|
2025-03-17 17:08:26 +08:00
|
|
|
|
typedef struct address_node
|
|
|
|
|
{
|
|
|
|
|
int n;
|
|
|
|
|
node* p;
|
|
|
|
|
}address_node;
|
|
|
|
|
|
|
|
|
|
|
2025-03-17 16:27:15 +08:00
|
|
|
|
// <20><>ʼ<EFBFBD><CABC><EFBFBD>ڵ<EFBFBD>
|
2025-03-21 13:07:47 +08:00
|
|
|
|
node* init_node(elem_type value);
|
2025-03-17 16:27:15 +08:00
|
|
|
|
|
|
|
|
|
// ɾ<><C9BE><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ڵ<EFBFBD>
|
|
|
|
|
void delete_node(node* n);
|
|
|
|
|
|
|
|
|
|
// <20>滻<EFBFBD>ڵ<EFBFBD>
|
2025-03-21 13:07:47 +08:00
|
|
|
|
void replace_node (node* n, elem_type value);
|
2025-03-17 16:27:15 +08:00
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>
|
2025-03-21 13:07:47 +08:00
|
|
|
|
void insert_node(node* head, elem_type value);
|
2025-03-17 16:27:15 +08:00
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>ʽڵ<CABD>
|
|
|
|
|
int get_node(node* n);
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>
|
2025-03-21 13:07:47 +08:00
|
|
|
|
address_node *find_node(node* head, elem_type value);
|
2025-03-17 16:27:15 +08:00
|
|
|
|
|
2025-03-17 17:08:26 +08:00
|
|
|
|
// <20><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>
|
|
|
|
|
void print_node_list(node* head);
|
2025-03-17 16:27:15 +08:00
|
|
|
|
|
2025-03-27 09:08:11 +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,elem_type value);
|
|
|
|
|
|
2025-03-17 16:27:15 +08:00
|
|
|
|
#endif
|
|
|
|
|
|