Welcome to the Monastery PerlMonks

### Re: Tree Structure Challenge

by LanX (Sage)
 on Nov 30, 2015 at 20:47 UTC ( #1148959=note: print w/replies, xml ) Need Help??

in reply to Tree Structure Challenge

I'm not sure if I get the problem, the naive solution is to collect all nodes from each tree with successive ->Parent calls and to construct the difference with cut operations. (like deleting hash slices)

What am I missing?

If the goal is to have minimal numbers of operations, we'd need to know things like if all leaves have the same distance to root.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

Replies are listed 'Best First'.
Re^2: Tree Structure Challenge
by choroba (Archbishop) on Nov 30, 2015 at 20:50 UTC
Basically, yes, that's it. One has to be careful with the bordercases, as usually. All leaves have the same distance to the root.
```(\$q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord
}map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+\$1,++print+eval\$q,q,a,
Yes = you want minimal number of operations?

Do the diff arrays need to be ordered?

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

Yes = you don't miss anything. No ordering needed.
```(\$q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord
}map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+\$1,++print+eval\$q,q,a,

Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1148959]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2022-08-19 05:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?

No recent polls found

Notices?