小杨用单链表保存任务序列,并同时维护头指针 head 和尾指针 tail。在链表非空且已知 tail 的情况下,在表尾插入新结点的时间复杂度是( )。
struct Node {
int value;
Node *next;
};
Node *head;
Node *tail;
- A.
- B.
- C.
- D.
g5-04599.in输出g5-04599.out小杨用单链表保存任务序列,并同时维护头指针 head 和尾指针 tail。在链表非空且已知 tail 的情况下,在表尾插入新结点的时间复杂度是( )。
struct Node {
int value;
Node *next;
};
Node *head;
Node *tail;