Proof of red-black tree height

I know that the height of a red-black tree is at most 2 lg (n + 1). But what is the mathematical proof of this? I have searched various sites, but I have not found any good evidence. I already know the properties of a red-black tree.

algorithms – Calculate the number of triangles that can be formed by joining special nodes in a tree

Source of the problem: CHGORAM2
Problem: a tree is given to us and its nodes are marked 1 or 0. We have to calculate how many triplets (x, y, z) can be formed so that the node x, y, z is marked as 1 and distance ( x, y) = distance (y, z) = distance (z, x) Here, the distance (x, y) indicates the distance between the node x and y. In addition, x, y, z must be distinct.

I can only solve it using brute force. But Editorial mentions an O (n) solution that I didn't understand.

Please help.

How to convert a decision table into a coherent decision tree?

I work from the presentation of the school, but I am not able to understand how they move from one stage to the next. Here is the decision table that I have.

enter description of image here

From there, the first thing we need to do is choose the root node from among these nodes:

enter description of image here

But I don't understand why for example from Q1 the branch Y has a1, a2 and the branch N has a1, a3.

This is the final solution for the tree:

enter description of image here

I don't know if this is the right name in English, this may be the reason why I couldn't find any literature online.

I would appreciate an explanation or at least a link to a guide on how to convert decision tables into optimal decision trees which are consistent with the decision table.

combinatorics – How to use Mathematica to solve this tree planting problem

To plant trees in the center of each small square in a 3 * 4 rectangular area, it is necessary that there is not a continuous number of three (or more) trees in three horizontal, vertical directions or diagonally, how many tree planting methods are there in total?

enter description of image here

1 means trees can be planted, 0 means trees cannot be planted.

but i don't know how to solve this problem with math and how to do it?

I already know that the following situations are the ones that meet the requirements of the problem:

enter description of image here

How to convert a complete binary tree to a priority search tree in O (n)

There don't seem to be any resources on this.
I would like to know if there is a linear time algorithm to convert a complete binary tree into a priority search tree.

c – What could be more efficient: generate a binary search tree or a linked list from random data (ish)?

Given that I have a data stack (of unknown size) with 16-bit indices, what is the most efficient way to put these indices in a sorted list (rebuild an index)? My intuition says an unbalanced binary tree, because the insertion should be (on average) faster than a linked list, and the conversion to an actual array should be roughly the same.

However, the number of indices will likely be small, as they each represent a “ thing '' & # 39; & # 39; that interests users, and the human brain tends to stop worrying about 10 or 100s of “ things ''. And, yes, this question is mainly academic, since users are unlikely to notice a significant difference in performance. In addition, this is implemented on a built-in microphone, so the size of the code and the memory footprint are relevant.

libraries – library to generate a tree structure of source code

I am developing in C # and I have not been able to find anything that resembles the tree structures found in most source control software. Ideally, it supports right clicks and custom labeling.

I have encountered a lot of custom hierarchy nuggets but nothing comparable to what I am looking for.

enter description of image here

PrimeNG Tree Checkbox displays check boxes on the right side of nodes

I need to display the check boxes on the right side of each tree node. is it possible to change the node label and distribution of check boxes?

python 3.x – Implement Red Black Tree using a parent class

I am trying to implement a black red tree. I want to create an object of class RedBlackTree with an attribute value inherited from the class Node, can someone help me in this area.
Thanks in advance.
Black red tree link:

class Node :
   def __init__(self,value):
       self.value = value
       self.left = None
       self.right = None
       self.colour = "RED"
       self.parent = None
class RedBlackTree( Node ) :
   def __init__(self):
       self.root = None
   def insert(self,x):
       if self.root == None:
           self.root = Node(x)
       elif self == None:
           self = Node(x)
       elif self.value > x:
           return insert(self.left, x)
           return insert(self.right, x)
   def left_rotate(self):
       temp = self.left.right
       self.left.right = self
       self.left.parent = self.parent
       self.parent = self.left
       self.left = temp
   def right_rotate(self):
       temp = self.right.left
       self.right.left = self
       self.right.parent  = self.parent
       self.parent = self.right
       self.right = temp
   def count_less_than(self, x):
       if self == None :
           return 0
       else :
           if self.value < x:
               return (1 + count_less_than(self.right, x) + count_less_than(self.left, x))
               return  count_less_than(self.left, x)

   def rebalance(x):
       root = x.root
       while ((x is not root) and (x.parent.colour == "RED")):
           if x.parent == x.parent.parent.left :
               y = x.parent.parent.right
               if y.colour == "RED":
               #Case 1
                   x.parent.colour = "BLACK"
                   x.parent.parent.right = "BLACK"
                   x.parent.parent = "RED"
                   x = x.parent.parent

                   if x == x.parent.right:
                   #Case 2

               #Case 3
                   x.parent = "BLACK"
                   x.parent.right = "RED"

               y = x.parent.parent.left
               if y.colour == "RED":
               #Case 1
                   x.parent.colour = "BLACK"
                   x.parent.parent.left = "BLACK"
                   x.parent.parent = "RED"
                   x = x.parent.parent

                   if x == x.parent.left:
                   #Case 2

               #Case 3
                   x.parent = "BLACK"
                   x.parent.left = "RED"
       root.colour = "BLACK"

Is this TREE sequence (3) correct?

Can anyone tell me if this TREE (3) sequence meets both TREE rules?!