Esempio n. 1
0
 public static Node_856 Create(Node_856 parent)
 {
     return(new Node_856
     {
         Parent = parent,
         Children = new List <Node_856>()
     });
 }
Esempio n. 2
0
        private Node_856 CreateParanthesesTree(string parantheses)
        {
            Node_856 parent = Node_856.Create(null);

            for (var index = 0; index < parantheses.Length; index++)
            {
                //Case 1 : When value is '('
                if (parantheses[index] == '(')
                {
                    var node = Node_856.Create(parent);
                    parent.Children.Add(node);
                    parent = node;
                }
                //Case 2 : When value is ')'
                else
                {
                    parent = parent.Parent;
                }
            }
            return(parent);
        }
Esempio n. 3
0
 private int CalculateScore(Node_856 node)
 {
     return(node.CalculateScore());
 }