## Tight upper bound for forming an $n$ element Red-Black Tree from scratch

I learnt that in a order-statistic tree (augmented Red-Black Tree, in which each node $$x$$ contains an extra field denoting the number of nodes in the sub-tree rooted at $$x$$) finding the $$i$$ th order statistics can be done in $$O(lg(n))$$ time in the worst case. Now in case of an array representing the dynamic set of elements finding the $$i$$ th order statistic can be achieved in the $$O(n)$$ time in the worst case.[ where $$n$$ is the number of elements].

Now I felt like finding a tight upper bound for forming an $$n$$ element Red-Black Tree so that I could comment about which alternative is better : "maintain the set elements in an array and perform query in $$O(n)$$ time" or "maintaining the elements in a Red-Black Tree (formation of which takes $$O(f(n))$$ time say) and then perform query in $$O(lg(n))$$ time".

So a very rough analysis is as follows, inserting an element into an $$n$$ element Red-Black Tree takes $$O(lg(n))$$ time and there are $$n$$ elements to insert , so it takes $$O(nlg(n))$$ time. Now this analysis is quite loose as when there are only few elements in the Red-Black tree the height is quite less and so is the time to insert in the tree.

I tried to attempt a detailed analysis as follows (but failed however):

Let while trying to insert the $$j=i+1$$ th element the height of the tree is atmost $$2.lg(i+1)+1$$. For an appropriate $$c$$, the total running time,

$$T(n)\leq \sum_{j=1}^{n}c.(2.lg(i+1)+1)$$

$$=c.\sum_{i=0}^{n-1}(2.lg(i+1)+1)$$

$$=c.\left[\sum_{i=0}^{n-1}2.lg(i+1)+\sum_{i=0}^{n-1}1\right]$$

$$=2c\sum_{i=0}^{n-1}lg(i+1)+cn\tag1$$

Now

$$\sum_{i=0}^{n-1}lg(i+1)=lg(1)+lg(2)+lg(3)+…+lg(n)=lg(1.2.3….n)\tag2$$

Now $$\prod_{k=1}^{n}k\leq n^n, \text{which is a very loose upper bound}\tag 3$$

Using $$(3)$$ in $$(2)$$ and substituting the result in $$(1)$$ we have $$T(n)=O(nlg(n))$$ which is the same as the rough analysis…

Can I do anything better than $$(3)$$?

All the nodes referred to are the internal nodes in the Red-Black Tree.

## New user, starting from scratch

I’m really sorry if I sound thick, I was given a windows vista laptop, I know it’s dangerous to go online with it but it was never used for 10 years, I’ve got a bootable USB and really like what I seeing, my problem is, everything is working apart from WiFi, does Linux work like Windows whereas you need to find and download drivers? If so, where could I find them? I don’t want to install ubuntu if I can’t use it online, thanks in advance and sorry for my lack of knowledge

## How to prove NP-hardness from scratch?

I am working on a problem of whose complexity is unknown. By the nature of the problem, I cannot use long edges as I please, so 3SAT and variants are almost impossible to use.

Finally, I have decided to go for the most primitive method — Turing Machines.

Oddly enough, I could not find any example of NP-hardness reduction done directly by modeling the problem as a language, and showing that a deterministic Turing Machine cannot decide whether a given instance belongs to that language (I might’ve messed up with the terminology here).

So, assuming that there are no problems to perform an NP-hardness reduction, how does one prove that a problem is NP-hard? Are there any publications that does this?

## How can you create a ruletta with javascript from scratch?

Hi guys,

How can you create a ruletta with javascript from scratch?

Timers, triggers?

It has to be completely from scratch, without… | Read the rest of http://www.webhostingtalk.com/showthread.php?t=1772571&goto=newpost

## Conversor de Decimal para Hexadecimal Scratch

Olá Amigos estou tentando fazer um conversor de Decimal para Hexadecimal em scratch só que 15 decimal da certo acima desse numero só mostra uma parte do valor

## Conversor de Decimal para Hexadecimal Scratch

Olá Amigos estou tentando fazer um conversor de Decimal para Hexadecimal em scratch só que 15 decimal da certo acima desse numero só mostra uma parte do valor

## Starting to create websites in HTML/CSS from scratch – basic instructions

Dear all,

I have created some pages already in WordPress e.g. https://eurogetwork.com/tworzenie-stron-internetowych-po-niemiecku/

Now I would like to resign from WordPress and start coding the pages from Scratch, because I want to have full control of what I am designing. If you have some basic and core instructions, which will help me to start with, please share.

best regards,
Oskar

## Converso de decimal para hexadecimal no scratch

Boa noite rapaziada, então preciso criar um projeto que é um conversou de decimal para hexadecimal na benção do scratch, alguém poderia me da uma luz??

## invalid type argument of -> compiling gmp-impl.h when using Linux from Scratch (LFS)

I am working on section 5.5 of LFS :

I haven’t ran into errors but I get an error when trying to make gcc. Here is the error:

In file included from ../../../gmp/mpf/set_str.c:58: ../../../gmp/mpf/set_str.c: In function '__gmpf_set_str': ../../../gmp/gmp-impl.h:4383:29: warning: implicit declaration of function 'localeconv' [-Wimplicit-function-declaration]  #define GMP_DECIMAL_POINT  (localeconv()->decimal_point)                              ^~~~~~~~~~ ../../../gmp/mpf/set_str.c:133:24: note: in expansion of macro 'GMP_DECIMAL_POINT'    const char  *point = GMP_DECIMAL_POINT;                         ^~~~~~~~~~~~~~~~~ ../../../gmp/gmp-impl.h:4383:41: error: invalid type argument of '->' (have 'int')  #define GMP_DECIMAL_POINT  (localeconv()->decimal_point)                                          ^~ ../../../gmp/mpf/set_str.c:133:24: note: in expansion of macro 'GMP_DECIMAL_POINT'    const char  *point = GMP_DECIMAL_POINT;                         ^~~~~~~~~~~~~~~~~ Makefile:448: recipe for target 'set_str.lo' failed make[5]: *** [set_str.lo] Error 1 make[5]: Leaving directory '/mnt/lfs/sources/gcc-8.2.0/build/gmp/mpf' Makefile:956: recipe for target 'all-recursive' failed make[4]: *** [all-recursive] Error 1 make[4]: Leaving directory '/mnt/lfs/sources/gcc-8.2.0/build/gmp' Makefile:775: recipe for target 'all' failed make[3]: *** [all] Error 2 make[3]: Leaving directory '/mnt/lfs/sources/gcc-8.2.0/build/gmp' Makefile:5645: recipe for target 'all-stage2-gmp' failed make[2]: *** [all-stage2-gmp] Error 2 make[2]: Leaving directory '/mnt/lfs/sources/gcc-8.2.0/build' Makefile:21584: recipe for target 'stage2-bubble' failed make[1]: *** [stage2-bubble] Error 2 make[1]: Leaving directory '/mnt/lfs/sources/gcc-8.2.0/build' Makefile:896: recipe for target 'all' failed make: *** [all] Error 2 

I had to move a lot of header files from the host computer in order to get the steps before this to work. I had to manually add header files to /tools/x86_64-pc-linux/include. I did those by coping the files that were throwing errors and adding them to the include folder. This may have caused a problem also but I am not certain of it.