relationship between binary numbers and binomial heaps

I understand that a binomial heap can be represented as binary numbers according to the degree of each tree but what exactly is the relationship between inserting a new node into the binomial heap and incrementing the binomial number.

In addition to that, I assume that there is a relationship between performing union on two binomial heaps and adding the two binary numbers of the binomial heaps but what exactly is the relationship.

I’m looking for something like a formal / textbook definition or of the relationship (if possible)

Proof that an almost complete binary tree with n nodes has at least $\frac{n}{2}$ leaf nodes

I’m having some trouble proving what my title states. Some textbooks refer to almost complete binary trees as complete, so to make myself clear, when I say almost complete binary tree I mean a binary tree whose levels are all full except for the last one in which all the nodes are as far left as possible.

I thought of proving it using induction but I’m not really sure how to do so. Any ideas?

Binary Search Complexity

I was reading an article about Binary Search on one of the websites on the internet that someone had linked, can’t find the link anymore, but this really is bothering me, and I think I am missing something.

function binary_search_alternative(Array, k) is     L := 0     R := n − 1     while L < R do         m := floor((L + R) / 2)         if k > A[m] then             L := m + 1         else:             R := m     if A[L] == k then         return L     return unsuccessful 

My thinking is that at each iteration we are taking an array (n-1) and after each iteration we are halving it so floor((n-1)2^i), where floor((n-1)2^i) = 1, this is before the last iteration, and my calculations show that the number of comparisons for this one is log(n-1), but the article said that it was log(n) + 1. Wikipedia has a similar code, and they say the same thing. How is that?

Node depth in randomly built binary search tree

It can be proved that randomly built binary search trees of size $ n$ are of depth $ O(log(n))$ and it is clear that level $ k$ has at most $ 2^{k}$ nodes (root’s level is 0).

I have an algorithm that traverses every path in the tree (beginning at the root) but stops after traversing $ k$ nodes (the parameter $ k$ is a configurable parameter which is independent of the size of the tree $ n$ ).

For any tree $ T$ with $ depth(T) > k$ , the algorithm will miss some nodes of the tree. I would like to bound the probability of my algorithm missing a large number of nodes.

Formalizing it: let $ T$ be a randomly built binary search tree of $ n$ nodes. I would like to calculate the probability for a node to have depth larger than $ k$ , as a function of $ n$ and $ k$ .

What is an $O(n \log(n))$ binary sorting algorithm with a guaranteed low scaling constant on the run-time?

Let $ O_c(f(n))$ denote that $ c$ is the scaling constant for the run-time (e.g. $ \text{run time} \leq c\cdot f(n) + B$ if $ n$ is large enough)

The absolute lower limit on the run-time for a binary sorting algorithm is $ \log_2(n!) \in O_{1}(n \log_2(n))$ .

My question is, is there an actual sorting algorithm guaranteed to achieve that optimal scaling of $ c=1$ on average? Or what’s the lowest possible scaling constant? And what sorting algorithm achieves the lowest (or a very low) scaling constant?

As a baseline, Quicksort achieves a scaling constant of $ c = 2 \ln(2) \approx 1.39$ , as explained on Wikipedia (see recurrences subsection).

Is there any danger to downloading a malware binary, but not executing it?

I recently downloaded an ELF file which was discovered from an exploit attempt (wget to download this binary failed due to outgoing traffic being blocked if it isn’t whitelisted). I downloaded it into a VM in order to run some basic analysis on it and uploaded it to virustotal.

My question is, absent some sort of terrible vulnerability in how curl downloads files or how analysis tools handle the files, is there any danger to a binary simply being on your system, without it ever being executed?

Faculty for binary trees instead of lists

i know how to count permutations within a list (–> n!), but what about binary trees? Subtrees from “siblings” are allowed to have their own order, otherwise it would be trivial.

here is an example for n=5

the root has 5 possibilities

each of the 2 children has 4 possibilities

each of the 4 grandchildren has 3 possibilities

each of the 8 grandgrandchildren has 2 possibilities

and the grandgrandgrandchildren have no choice

how to calculate the total number for n?

How to compute the general term formula for the number of full binary tree heaps that can be formed with distinct elements?

The number of possible heaps that are full binary trees of height $ h$ and can be formed with ($ n = 2^h – 1$ ) distinct elements can be computed by recursion: $ $ a_h = {2^h – 2 \choose 2^{h – 1} – 1} a_{h – 1}^2 $ $ How to compute the general term formula with this recursion formula?