#GESP4269. [GESP]L5-202609-Q4269-S

[GESP]L5-202609-Q4269-S

小杨用单链表保存任务序列,并同时维护头指针 head 和尾指针 tail。在链表非空且已知 tail 的情况下,在表尾插入新结点的时间复杂度是( )。

struct Node {
    int value;
    Node *next;
};

Node *head;
Node *tail;

{{ select(1) }}

  • O(1)O(1)
  • O(log⁡n)O(\log n)
  • O(n)O(n)
  • O(nlog⁡n)O(n\log n)