diff --git a/p5/README.md b/p5/README.md index 732ad15014d0198867474ce8bccccddd8a49ee0e..ec9b0314dc663cf8071727003306257c6f7954d1 100644 --- a/p5/README.md +++ b/p5/README.md @@ -134,21 +134,37 @@ read strings: [one two three] > ``` +You tree should make calls that roughly mirror: + +``` + one := createTreeNode(uint64(rand.Intn(1000)), "one") + two := createTreeNode(uint64(rand.Intn(1000)), "two") + three := createTreeNode(uint64(rand.Intn(1000)), "three") + four := createTreeNode(uint64(rand.Intn(1000)), "four") + SetLeft(one.oid, two.oid) + SetRight(one.oid, three.oid) + SetLeft(two.oid, four.oid) +``` +and then print out, for each node, the label, and the labels of the left and right children: ``` > go run tree.go -"four" -"two" -"three" -"one" +"one": "two", "three" +"two": "four", "" +"three": "", "" +"four": "", "" > +``` + +Likewise, another *reader* process running at the same time should see the same tree-node creation and mutation events, construct an exact copy of the tree, and print out the same representation: +``` > go run tree.go -r "one": "two", "three" "two": "four", "" "three": "", "" "four": "", "" -> ``` + You will need to define your own implementation for the tree from scratch. Your tree nodes should conform to `TreeNodeInterface`. Operations consist of creating, setting the left