[問題] 請問path compression
小弟是data structure初學者...
想請問path compression的定義
書上是這麼寫的
"We can make paths in the trees even shorter by simply making all the objects
that we touch point to the root of the new tree for the union operation."
那如果
我今天的tree大概長這樣
0 5
^ |
1 3 6
| |
2 4
0,5是root
那如果
我對(2,6)做union operation
新的tree應該變怎樣
是
A) 0 B) 0 C) 0 5
^ ^ ^
1 2 3 5 6 1 2 3 5 1 2 3 6
| | | |
4 4 6 4
哪一種??
謝了...
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.233.41.22
推
03/10 01:23, , 1F
03/10 01:23, 1F
→
03/10 01:24, , 2F
03/10 01:24, 2F
→
03/10 01:25, , 3F
03/10 01:25, 3F
推
03/10 01:30, , 4F
03/10 01:30, 4F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章