Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <class HashedObj>
- int QuadraticHashTable<HashedObj>::findPos( const HashedObj & x ) const
- {
- /* 1*/ int collisionNum = 0;
- /* 2*/ int currentPos = hash( x.portNum, array.size( ) );
- /* 3*/ while( array[ currentPos ].info != EMPTY &&
- array[ currentPos ].element != x.portNum )
- {
- /* 4*/ currentPos += 2 * ++collisionNum - 1; // Compute ith probe
- /* 5*/ if( currentPos >= array.size( ) )
- /* 6*/ currentPos -= array.size( );
- }
- /* 7*/ return currentPos;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement