我试图找出在红黑树的旋转,而它的再平衡已经完成。我明白为什么轮换会发生,但我不明白是怎么做到的。此外,什么样的中间轮,如LL,RR,LR和RL,直到结果,我也会很感激,如果有人告诉我的经验规则,什么时候做任何这些轮换。这是轮调:
Rr(2) is the case when black node deficiency is in right child of "py" i.e.
"y" and grandchild of "v" are 2 red nodes i.e. "b" and "x"
我必须使用BlockingQueue解决生产-消费者问题。我希望它是1个元素队列。因此解决方案必须是: 生产%1消耗%1生产%2消耗%2生产%3消耗%3 但它确实是: 生产1生产2消费1消费2生产3生产4等等。 我目前使用的SynchronizedQueue是这样的: class Producent extends Thread {
private final BlockingQueue<Integer> blockingQueue;
public Producent(BlockingQueue<Integer> blockingQueue) {
this.