← 回題庫

卷別

資料結構與演算法

選擇

國立臺灣大學 2023 · 考試 · 第 4 題

考科演算法

(5 points)(單選)We now use several algorithms to traverse a binary tree. Assuming there are a total number of NN nodes, how many of the following statements about the worst-case space complexity are TRUE?

  • Using DFS to traverse a balanced binary tree takes O(N)O(N).
  • Using DFS to traverse a binary tree takes O(N)O(N).
  • Using BFS to traverse a balanced binary tree takes O(N)O(N).
  • Using BFS to traverse a binary tree takes O(N)O(N).
  • (A)
    0
  • (B)
    1
  • (C)
    2
  • (D)
    3
  • (E)
    4

標準解析

AI 已複查