資料結構›Ch5 樹狀結構
第 41 題/共 48 題
◀ DS 41/48
41. Binary Tree、遞迴、Traversal
#DS-05-041易Binary Tree遞迴Traversal
題組題幹(本題:(ii),共 2 小題)點擊展開
  1. [2%, 2%] The following data structure represents a binary tree, and it contains a function named "unknown".
struct node{
    int data;
    struct node *left, *right;
};

void unknown(struct node *p) {
    struct node *q;
    if (p->left != NULL) unknown(p->left);
    if (p->right != NULL) unknown(p->right);
    q = p->left;
    p->left = p->right;
    p->right = q;
}

(ii) You are given the following input. Once the unknown(r) is performed, what is the value of the rightmost leaf node?

樹狀輸入

📄 成大111
跳轉到第題
▤完整推導請見《WH 資工筆記 · 資料結構》Ch5 樹狀結構
本章題號 · 41–48 / 48