Corrects README.md

This commit is contained in:
Anurag Agarwal 2020-08-08 00:53:30 +00:00
parent 8e060ad0ad
commit 8b92bc6bb6
No known key found for this signature in database
GPG Key ID: CF5E14552DA23F13
2 changed files with 11 additions and 6 deletions

View File

@ -141,11 +141,16 @@ public final class NullNode implements Node {
Then we can construct and traverse the binary tree without errors as follows.
```java
Node root =
new NodeImpl("1", new NodeImpl("11", new NodeImpl("111", NullNode.getInstance(),
NullNode.getInstance()), NullNode.getInstance()), new NodeImpl("12",
NullNode.getInstance(), new NodeImpl("122", NullNode.getInstance(),
NullNode.getInstance())));
var root = new NodeImpl("1",
new NodeImpl("11",
new NodeImpl("111", NullNode.getInstance(), NullNode.getInstance()),
NullNode.getInstance()
),
new NodeImpl("12",
NullNode.getInstance(),
new NodeImpl("122", NullNode.getInstance(), NullNode.getInstance())
)
);
root.walk();
// 1

View File

@ -37,7 +37,7 @@ public class App {
* @param args command line args
*/
public static void main(String[] args) {
Node root = new NodeImpl("1",
var root = new NodeImpl("1",
new NodeImpl("11",
new NodeImpl("111", NullNode.getInstance(), NullNode.getInstance()),
NullNode.getInstance()