← 回題庫

卷別

資料結構與演算法(A)

選擇

國立臺灣大學 2021 · 考試 · 第 13 題

(5 points) There is a linked-list with nn elements x1,x2,…,xnx_1, x_2, \dots, x_n. Let f(n)f(n) be the time complexity of inserting a new element xn+1x_{n+1} to the tail of the list, and g(n)g(n) be that of deleting the last element xnx_n. If there is only one pointer pointed to the head of the list, the functions are denoted f1(n),g1(n)f_1(n), g_1(n). To improve it, we may also add another pointer pointed to the tail, so the functions become f2(n),g2(n)f_2(n), g_2(n). Which of the following option is false if nn becomes large?

  • (A)
    f1(n)g1(n)=1\dfrac{f_1(n)}{g_1(n)} = 1
  • (B)
    f2(n)g2(n)=n\dfrac{f_2(n)}{g_2(n)} = n
  • (C)
    f1(n)f2(n)=n\dfrac{f_1(n)}{f_2(n)} = n
  • (D)
    g1(n)g2(n)=1\dfrac{g_1(n)}{g_2(n)} = 1

標準解析

AI 已複查