資料結構›Ch9 進階樹
第 71 題/共 88 題
◀ DS 71/88
71. Fibonacci Heap、Decrease Key、Cascading Cut、攤還分析
#DS-09-071易Fibonacci HeapDecrease KeyCascading Cut攤還分析

[2%, 2%, 2%, 2%] Consider the two missing parts for the decrease key operation in F-heap.

DecreaseKey(H, x, k){
  if k > x.key return "error"
  x.key = k
  y = x.p   // note: x.p represents the parent node of x

  if y != NIL and (1) {
    CUT(H, x, y)
    CASCADING-CUT(H, y)
  }
  if x.key < H.min.key
      H.min = x
}

CUT(H, x, y){
  x.p = (2)
  x.mark = FALSE
}

CASCADING-CUT(H, y){
  z = y.p
  if z != NIL
    if y.mark == FALSE
        y.mark = TRUE
    else {
        CUT(H, y, z)
        CASCADING-CUT(H, z)
    }
}

(i) Which of the following for (1) is true? (A) x.key<y.keyx.key < y.key (B) x.key>y.keyx.key > y.key (C) x.key≥y.keyx.key \ge y.key (D) x.key≤y.keyx.key \le y.key

(ii) Which of the followings is true for (2)? (A) NIL (B) yy (C) xx (D) None of the above

(iii) What is the amortized time complexity of function DecreaseKey? (A) O(1)O(1) (B) O(n)O(n) (C) O(lg⁡n)O(\lg n) (D) O(lg⁡n2)O(\lg n^2)

(iv) What is the time complexity of inserting node into F-heap? (A) O(1)O(1) (B) O(n)O(n) (C) O(lg⁡n)O(\lg n) (D) O(lg⁡n2)O(\lg n^2)

📄 成大111
跳轉到第題
▤完整推導請見《WH 資工筆記 · 資料結構》Ch9 進階樹
本章題號 · 61–80 / 88