public int search ( int data , int treap ) { int cur = getRoot ( treap ) ; while ( cur != nullNode ( ) ) { int res = m_comparator . compare ( this , data , cur ) ; if ( res == 0 ) return cur ; else if ( res < 0 ) cur = getLeft ( cur ) ; else cur = getRight ( cur ) ; } m_comparator . onEndSearchImpl_ ( data ) ; return nullNode ( ) ; }
Finds an element in the treap and returns its node or - 1 .