← 回題庫

卷別

資料結構與演算法(A)

選擇

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

(5 points) There is a binary tree stored in an array as:

T[]={+,a,∗,null,null,−,d,null,null,null,null,b,c},T[] = \{+, a, *, null, null, -, d, null, null, null, null, b, c\},

in which T[i]T[i] is the parent of T[2i+1]T[2i+1] and T[2i+2]T[2i+2], where ii is an index and nullnull means there is no element in the slot. What is its postorder traversal result?

  • (A)
    +a∗−dbc+a*-dbc
  • (B)
    a+b−c∗da+b-c*d
  • (C)
    abc−d∗+abc-d*+
  • (D)
    +a∗−bcd+a*-bcd

標準解析

AI 已複查