Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/oze4/generateandprintfullbinarytrees
- Owner: oze4
- License: unlicense
- Created: 2024-08-20T19:20:18.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-08-20T19:31:19.000Z (5 months ago)
- Last Synced: 2024-09-13T14:09:03.857Z (4 months ago)
- Language: Go
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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 := 7results := 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│
╰─╯ ╰─╯```