c# - Display a list of nodes in a TreeView -
I have a node object that specifies the node level
public class node { Public int level {receive; Set; }} I want to use a sorted list of nodes to create a tree view
var nodes = new [] {new node ( ) {Level = 0}, new node () {level = 1}, new node () {level = 1}, new node () {level = 1}, new node () {level = 2}, new node ) {Level = 1}, new node () {level = 2}, new node () {level = 2}, new node () {level = 3},}; What is the most effective way to do this
thanks
Rohan
Running from the buo, you want to keep a heap of nodes, as you go to a higher level if the level on the current node is high, the previous node Press on the stack and use it as a parent. If the level is lower than the previous node, then use the stop stop nodes (n = previous_level - current_level) and the new stack-top as the parent.
Comments
Post a Comment