Tree (directed acyclic graph) implementation

前端 未结 4 1960
忘掉有多难
忘掉有多难 2020-12-14 22:22

I require a tree / directed acyclic graph implementation something like this:

public class TreeNode {
    private K key; // \'key\' for this node         


        
4条回答
  •  一个人的身影
    2020-12-14 23:24

    I'd say it's better to roll out your own implementation (besides, you've already got the interface nicely thought out). What are the operations you are planning to perform on this tree anyway? You'd probably want to design your API around the things you want... direct access to individual nodes by key/value? types of traversals? add/remove operations?

提交回复
热议问题