Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/oze4/generateandprintfullbinarytrees

Just messing with generating and printing full binary trees. Wanted to save this just in case.
https://github.com/oze4/generateandprintfullbinarytrees

Last synced: about 2 months ago
JSON representation

Just messing with generating and printing full binary trees. Wanted to save this just in case.

Awesome Lists containing this project

README

        

# GenerateAndPrintFullBinaryTrees
Just messing with generating and printing full binary trees. Wanted to save this just in case.

---

**The following code...**

```go
n := 7

results := allPossibleFBT(n)

for _, result := range results {
printTreeNode(result)
}
```
**...prints:**

```
╭─╮
│0│
╰┬╯
╭─────┴─╮
╭┴╮ ╭┴╮
│0│ │0│
╰─╯ ╰┬╯
╭───┴─╮
╭┴╮ ╭┴╮
│0│ │0│
╰─╯ ╰┬╯
╭─┴─╮
╭┴╮ ╭┴╮
│0│ │0│
╰─╯ ╰─╯

╭─╮
│0│
╰┬╯
╭─────┴─╮
╭┴╮ ╭┴╮
│0│ │0│
╰─╯ ╰┬╯
╭─┴───╮
╭┴╮ ╭┴╮
│0│ │0│
╰┬╯ ╰─╯
╭─┴─╮
╭┴╮ ╭┴╮
│0│ │0│
╰─╯ ╰─╯

╭─╮
│0│
╰┬╯
╭─┴─────╮
╭┴╮ ╭┴╮
│0│ │0│
╰┬╯ ╰─╯
╭───┴─╮
╭┴╮ ╭┴╮
│0│ │0│
╰─╯ ╰┬╯
╭─┴─╮
╭┴╮ ╭┴╮
│0│ │0│
╰─╯ ╰─╯

╭─╮
│0│
╰┬╯
╭─┴─────╮
╭┴╮ ╭┴╮
│0│ │0│
╰┬╯ ╰─╯
╭───┴─╮
╭┴╮ ╭┴╮
│0│ │0│
╰─╯ ╰┬╯
╭─┴─╮
╭┴╮ ╭┴╮
│0│ │0│
╰─╯ ╰─╯

╭─╮
│0│
╰┬╯
╭─┴─────╮
╭┴╮ ╭┴╮
│0│ │0│
╰┬╯ ╰─╯
╭─┴───╮
╭┴╮ ╭┴╮
│0│ │0│
╰┬╯ ╰─╯
╭─┴─╮
╭┴╮ ╭┴╮
│0│ │0│
╰─╯ ╰─╯

```