#14023. [GESP202609 五级 C++] 第 1 题

[GESP202609 五级 C++] 第 1 题

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

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

Node *head;
Node *tail;

{{ select(1) }}

  • O(1)O(1)
  • O(logn)O(\log n)
  • O(n)O(n)
  • O(nlogn)O(n\log n)