tries are graphs where nodes have only 1 parent.

2 general ways of implementing trees in J:  

Nested boxing has the advantage of easy visualization, and parent first 
traversal should hope to be fast.

A table were one item of each row holds the index (row) of its parent, or a 
list if an associated table will hold the data elements of each node is faster 
on every other access/manipulation task, and even has advantages for parent 
first traversal.

Working with trees this way is a similar way to structuring/working with graphs 
where multiple "parents" (links between nodes called edges) are just 
represented with multiple rows.





On Monday, April 12, 2021, 02:49:34 a.m. EDT, Emir U <[email protected]> 
wrote: 





Thank you Ric and Robert. A trie is more like a nested hash table than a mere 
tree.  It is essential in a trie (as it is in a hash table) that you have O(m) 
time lookup. That is, a trie is more than a hierarchical boxing of values or a 
vector presentation of a trees relationships.

From your links Ric, I dismay somewhat at Dan Bron's conclusion because it is 
exactly what the sceptic in me was thinking: "If you're already an 
array-thinker, and you're familiar with J, and still conclude your program 
(primarily) needs to manipulate trees, perhaps you should write it in another 
language.  One of J's primary advantages is that it makes (array) programming 
easy.  If its notation is inapplicable to your problem (more or less), there is 
not much reason left to use it."

Emir
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to