資料結構›Ch4 鏈結串列第 20 題/共 22 題
20. Linked List
#DS-04-020易Linked List
The pseudo code below aims to reverse a linked list.
typedef struct Node{
int data;
Node *next;
};
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 = P;
P = C;
C = N;
}
(2)
}
Which of the following statements are true?
📄 中央110
▤完整推導請見《WH 資工筆記 · 資料結構》Ch4 鏈結串列