Talk:Tree datastructures: Difference between revisions

 
(4 intermediate revisions by 2 users not shown)
Line 1:
==Attribution==
My thanks to Ralf Ebert who asked this [https://stackoverflow.com/q/58398986/10562 question] on Stack Overflow which introduced myme to the indent form. I answered his question then thought of RC. --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 08:28, 17 October 2019 (UTC)
 
==Good idea for a task – a couple of thoughts.==
Line 78:
- from the next line which shares the indent level of the first line,
- to the last line of the outline.</pre>
 
==Generic tree to indent-type datastructure conversion==
The following is the diagram from the [[Tree traversal]] task annotated with depth information for the nodes:
:NODE_DEPTH
1 :0
/ \
/ \
/ \
2 3 :1
/ \ /
4 5 6 :2
/ / \
7 8 9 :3
 
A '''preorder''' traversal of the tree outputting <code>(node_depth, node_name)</code> pairs will generate the indent form of this and other rooted trees. --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 21:43, 19 October 2019 (UTC)
 
==Task tree in dot format, and diagram==
<lang dot>digraph rc {
node [fontsize=12 height=0.1 nodesep=0.25 width=0.1]
RosettaCode -> rocks
rocks -> code
rocks -> comparison
rocks -> wiki
RosettaCode -> mocks
mocks -> trolling
RosettaCode [color=brown fontcolor=green fontname=bold]
}</lang>
 
* [https://commons.wikimedia.org/wiki/File:RC_Tree_Datastructures_diagram.svg Diagram of tree shown in task: Tree datastructures]
<br> --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 10:06, 20 October 2019 (UTC)
Anonymous user