Initialize the vectors
function intisalise ( ) { startIdx = new Array ( n + 1 ) ; endIdx = new Array ( n + 1 ) ; p = new Array ( n + 1 ) ; for ( let i = 0 ; i < ( n + 1 ) ; i ++ ) { startIdx [ i ] = 0 ; endIdx [ i ] = 0 ; p [ i ] = 0 ; } }