patmorin / ods

Mission: To provide a high-quality open content data structures textbook that is both mathematically rigorous and provides complete implementations.
http://opendatastructures.org/
Other
1.21k stars 249 forks source link

Some very serious error at page 184 #84

Open Fantasy-Rain opened 4 years ago

Fantasy-Rain commented 4 years ago

Those nil's are considered as nodes when calculation, but not included in data_nodes(T)=n.

So given a red-black tree T with n data nodes, the two highlighted parts should be: log(n+1)+1, log(n+1).

Then height(T)= ((log(n+1)+1)+log(n+1)) - 1= 2log(n+1). (when calculating height, nil's are included; both CLRS, GeeksForGeeks gives the same result.)

This error has to be fixed immediately.

image

LautaroLobo12 commented 4 years ago

I'm on it!