Skip to main content

average_path_length

Function average_path_length 

Source
pub fn average_path_length(n: usize) -> f64
Expand description

Expected path length of a random BST with n nodes.

Formula: c(n) = 2 H(n-1) - 2(n-1)/n where H is the harmonic number.