資料結構›Ch4 鏈結串列第 21 題/共 22 題
21. Linked List
#DS-04-021易Linked List
The pseudo code below aims to reverse a linked list.
struct Node {
int data;
struct Node* next;
};
typedef struct Node* NPtr;
int main()
{
NPtr head = NULL; /* Start with an empty linked list */
push(&head, ...); /* insert items into the linked list */
reverse(&head); /* reverse the linked list */
}
void reverse(NPtr* Href)
{
NPtr P = NULL;
NPtr C = *Href;
NPtr N = NULL;
while ( (1) ) {
N = C->next;
C->next = (2) ;
P = C;
C = N;
}
(3)
}
Which of the following statements are true?
📄 中央111
▤完整推導請見《WH 資工筆記 · 資料結構》Ch4 鏈結串列