推 mkia1142:太謝謝你了!! 03/04 13:09
※ 引述《mkia1142 (maki)》之銘言:
: 題目如下
: The table below represents a portion of a computer's main memory containing
: a binary tree. Each node consists of three cells,the first being data ,
: the second being a pointer to the node'sleft child, and the third being a
: pointer to the node's right child.If the nil pointer is represented by 00
: and the tree's root pointer contains 53, draw a picture of the tree showing
: the data in each node?
: address contents
題目說
有一棵binary tree (class)
裡面包了三個東西 (data member)
分別為 資料.左指標.右指標
已知當指標空的時候會指向00
而指向最上層(root)的指標內容為53
要你畫出整棵樹
: 50 AA
: 51 56
: 52 00
: 53 BB
: 54 00
: 55 50
: 56 CC
: 57 00
: 58 00
: 麻煩大家了 >"< 有點看不大懂意思
: P.S高師99年計概
因為root pointer指向53
所以53之後的連續三個為root的data
(正常來說,宣告會排在一起)
BB為root的資料
00為左指標
50為右指標
=>左邊沒人,右邊指向"記憶體位置"50
所以依此類推
最後就是
BB
/ \
Null AA
/ \
CC Null
/ \
Null Null
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.42.18.130