Find missing elements of a range | Print all elements of range [ low , high ] that are not present in arr [ 0. . n - 1 ] ; Create boolean array of size high - low + 1 , each index i representing wether ( i + low ) th element found or not . ; if ith element of arr is in range low to high then mark corresponding index as true in array ; Traverse through the range and prlet all elements whose value is false ; Driver program
function prletMissing ( arr , low , high ) { let polets_of_range = Array ( high - low + 1 ) . fill ( 0 ) ; for ( let i = 0 ; i < arr . length ; i ++ ) { if ( low <= arr [ i ] && arr [ i ] <= high ) polets_of_range [ arr [ i ] - low ] = true ; } for ( let x = 0 ; x <= high - low ; x ++ ) { if ( polets_of_range [ x ] == false ) document . write ( ( low + x ) + " " ) ; } } let arr = [ 1 , 3 , 5 , 4 ] ; let low = 1 , high = 10 ; prletMissing ( arr , low , high ) ;