Is there a way to swap the positions of nodes in a tree?any function, or any other way?
1 view (last 30 days)
Show older comments
I am trying to write the code for modified adaptive huffman coding, in that based on the incoming data the nodes are to be shifted close to the root node if their occurrence is frequent. For example this is my code:
clc;
tr=tree('NYT');
[tr, NYT1]=tr.addnode(1,'0');
[tr, n1]=tr.addnode(1,'node(1).data');
[tr, NYT2]=tr.addnode(2,'0');
[tr, n2]=tr.addnode(2,'node(2).data');
disp(tr.tostring);
the following appears in the command window
NYT
+--------+-----+
! !
0 node(1).data
+----+---+
! !
0 node(2).data
My question is, is there a way to swap the positions of node1 and node2 such that node2 goes up and node1 comes down? http://tinevez.github.io/matlab-tree/
I am going through the above link for understanding the construction and editing a tree. Thanks for your time!
0 Comments
Answers (0)
See Also
Categories
Find more on Large Files and Big Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!