## discrete mathematics – Height of AVL tree with balance condition of 2

Let $$T_h$$ denote the minimal number of nodes that a standard AVL tree of height $$h$$ could have.

If $$h>0$$, then there’s the root and two subtrees. One of the subtrees must have height $$h-1$$. The other must have height at least $$h-2$$, otherwise it’s not a valid AVL tree. So we have the recurrence:

$$T_h = T_{h-1} + T_{h-2} + 1$$

And we can throw in $$T_0 = 0$$ and $$T_1 = 1$$ for obvious reasons.

The easy way to solve the recurrence is to denote $$F_h = T_h + 1$$. Then:

begin{align*}F_0 & = 1 \ F_1 & = 2 \ F_h & = F_{h-1} + F_{h-2}end{align*}

That is, they’re Fibonacci numbers with the sequence offset by 3.

Since:

$$F_h approx frac{1}{sqrt{5}} left( frac{1 + sqrt{5}}{2} right)^{h+3}$$

Inverting this, we get:

$$h approx frac{1}{log left( frac{1 + sqrt{5}}{2} right)} log left( T_h right) + 3$$

And that is where the 1.44 comes from.

So what you need is to solve the recurrence:

$$U_h = U_{h-1} + U_{h-3} + 1$$

with suitable initial conditions.

If you can’t think of a clever way to do this, you can do it the not-clever-but-always-works way by observing that:

$$begin{bmatrix} U_h \ U_{h-1} \ U_{h-2} \ 1end{bmatrix} = begin{bmatrix} 1 & 0 & 1 & 1 \ 1 & 0 & 0 & 0 \ 0 & 1 & 0 & 0 \ 0 & 0 & 0 & 1end{bmatrix} begin{bmatrix} U_{h-1} \ U_{h-2} \ U_{h-3} \ 1end{bmatrix}$$

Therefore:

$$begin{bmatrix} U_{h+2} \ U_{h+1} \ U_{h} \ 1end{bmatrix} = begin{bmatrix} 1 & 0 & 1 & 1 \ 1 & 0 & 0 & 0 \ 0 & 1 & 0 & 0 \ 0 & 0 & 0 & 1end{bmatrix}^{h} begin{bmatrix} U_{2} \ U_{1} \ U_{0} \ 1end{bmatrix}$$

Next, perform eigendecomposition on the matrix. Let:

$$M = begin{bmatrix} 1 & 0 & 1 & 1 \ 1 & 0 & 0 & 0 \ 0 & 1 & 0 & 0 \ 0 & 0 & 0 & 1end{bmatrix}$$

Suppose you can find a matrix $$Q$$ and a diagonal matrix $$Lambda$$ such that $$M = Q Lambda Q^{-1}$$. Then:

$$M^h = Q Lambda^h Q^{-1}$$

Taking the power of a diagonal matrix is trivial, and this should give you a closed form. You will then need to find an approximate inverse to solve your problem.

## unity – Change rigidbodys default height from floor?

I am new to unity and I have a few questions:

There is a mesh that has a rigidbody and a box collider that I placed on the scene.
I also added a generic terrain to the scene from the 3D objects menu.
When I put the mesh at a certain height and it drops I notice that it always stops at Y = 0.500000.

How do I change this default value? What controls this? For example, does unity have it so that when any other type of collider hits the terraincollider the other collider automatically updates the rigidbody to be 0.50000 above it and this only happens when it hits a terrain collider?

If this is the case, Is this causing a collision every frame and adjusting it to 0.50000 every frame so it doesnt fall through?

Finally, assuming that the Y = 0.50000 value above the ground cannot be changed, if I wanted something to “hoover” above the ground, would I always need to take that the maximum amount that I can get to the ground is Y = 0.500000?

## inner scrollbars – Scrolling dilemma with content of variable/dynamic height

I have a page with that displays a multi-step form in an `<iframe>`. The form is from a 3rd party service so I have no control over usage of the `<iframe>` or any of its content’s styling… including width. The general layout of the page looks like this:

This is all well and good for Step 1 of the form, but in Step 2, the length of the form more than triples. I have no way of knowing the height of the content at each step and therefore can’t resize the height of the `<iframe>` accordingly, so unless I want the `<iframe>` to scroll, I have to set its height to something ridiculously large (which will probably look pretty odd on Step 1)…

So I feel like my only option here is to keep the `<iframe>` sized at its Step 1 height and have it scroll for steps 2 and 3:

And this brings me to my real question: I personally don’t like scrolling frames within an already-scrolling parent page. It usually feels clunky and awkward… especially on mobile devices. But I see it quite frequently… is this just a bad design pattern being used so much it becomes acceptable? And how does scrolling a long form in a container one third of its height affect usability?

Any insight or suggestions for improvement (given the limitations I’m facing with the 3rd party’s content (and the `<iframe>` itself for that matter) would be greatly appreciated.

## plugins – How to make same height ICON BOXES – WP BAKERY

I am trying to make same height all the icon boxes which we can use from wp-Bakery plugin.

To be more specific i have 5 columns close to each other. Every column has one icon box. Icon boxes have one icon and below the icon a text. The problem is when I change monitor(px) the icon boxes are never the same height. I tried to change the height of the column or the height of the row but nothing is change.

Can you suggest a solution?
Thank you.

## bounding the height of stack when checking acceptance pushdown automaton

Let $$A$$ be a nondeterministic PDA (with empty stack acceptance). I am looking for a reference for a statement of the following form.

There exists a constant $$c$$, computable from $$A$$, such that:
if $$w$$ is accepted by $$A$$ then there is an accepting computation of $$w$$ on $$A$$ with stack height at most $$c|w|$$.

From this it would follow that we can decide whether $$A$$ accepts $$w$$ without going via equivalent context-free grammars.

## Dynamic or Fixed height for Modal window

Need your help to clarify one query related to the modal. My question is whether the modal height should be dynamic or fixed? Dynamic I refer to is that the modal height varies based on the amount of content & fixed modal will always have a fixed height regardless of the amount of content. For fixed modal, there will be an internal scrollbar to scroll the content. Sample images attached (first image represent the dynamic & the other 2 fixed).
Which approach is the correct one as per the UX principles & widely used one?
Thanks in advance!

## html – Flex forçado em 2 colunas sem haver um height fixo

Bom dia pessoal.

Estou criando um menu para um restaurante dentro do wordpress, utilizando Advanced Custom Fields Pro para criar a lista do menu.

A ideia é criar, para desktop, o menu dentro de duas colunas, desta forma:

Porém a dificuldade está em lidar com o tamanho total do container, pois eu não sei a quantidade de categorias e nem a quantidade de produtos dentro de cada categoria, isso irá depender do restaurante e pode mudar quando eles quiserem. Com isso, precisava forçar a quebra da coluna 1 em algum momento, mas, se faço isso com uma height definida e o restaurante tira/acrescenta itens, o esquema todo quebra.

Se eu deixo o flex em column, ele coloca as categorias uma abaixo da outra e se eu coloco uma height fixa ele quebra ali e pode gerar itens pra fora do container ou grandes espaços vazios se as categorias forem retiradas ou acrescidas… Não sei o que fazer!

Vou deixar aqui a “ideia” do código, pois como o ambiente é o WP e estou usando ACF fica impossível mostrar corretamente aqui fora…

Resumindo:

Como fazer o Flex entender que eu quero sempre 2 colunas e, forçando ainda mais a barra, que ele deixe mais ou menos com a mesma altura ambas as colunas.

Seria possível?

Desde já agradeço a colaboração.

## html – bootstrap different height ratio expect 1:1 for columns when small devices view

First of all, I had no idea what kind of research I should do. So I may have asked a duplicate question.

Anyway, I have a simple code like this:

``````#my-container {
height: 100vh;
}``````
``````<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" />

<div id="my-container" class="container-fluid p-0 m-0">
<div class="row p-0 m-0 h-100 text-white">
<div class="col-sm-8 bg-success">COL 1</div>
<div class="col-sm-4 bg-danger">COL 2</div>
</div>
</div>``````

As you can see, I have 2 columns in 8 by 4 ratio that cover the whole page. And as you know, when viewed on these small devices, it appears in 2 rows at a 1:1 ratio. Like This:

But I want a different height ratio for these two columns. For example, like this (8:2):

## Editing Header Height in Ashe child theme

#### Stack Exchange Network

Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange