File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -10,11 +10,8 @@ type node struct {
1010 childCount int
1111}
1212
13- func (n * node ) setChildNode (newNode * node ) bool {
14- //fmt.Printf("settingChildNode: %v\n", newNode)
15- n .childCount ++
16- n .children = []* node {newNode }
17- return true
13+ func (n * node ) IsLeaf () bool {
14+ return n .childCount == 0
1815}
1916
2017func (n * node ) makeChildNode (s string ) * node {
@@ -29,6 +26,13 @@ func (n *node) makeChildNode(s string) *node {
2926 return & child
3027}
3128
29+ func (n * node ) setChildNode (newNode * node ) bool {
30+ //fmt.Printf("settingChildNode: %v\n", newNode)
31+ n .childCount = 1
32+ n .children = []* node {newNode }
33+ return true
34+ }
35+
3236func makeNode (s string ) node {
3337 //fmt.Printf("makingNode: %s\n", s)
3438 return node {value : s , childCount : 0 }
You can’t perform that action at this time.
0 commit comments