void deleteElement ( int list , int prevNode , int node ) { if ( prevNode != nullNode ( ) ) { assert ( m_listNodes . getField ( prevNode , 1 ) == node ) ; m_listNodes . setField ( prevNode , 1 , m_listNodes . getField ( node , 1 ) ) ; if ( m_lists . getField ( list , 1 ) == node ) // deleting a tail { m_lists . setField ( list , 1 , prevNode ) ; } } else { assert ( m_lists . getField ( list , 0 ) == node ) ; m_lists . setField ( list , 0 , m_listNodes . getField ( node , 1 ) ) ; if ( m_lists . getField ( list , 1 ) == node ) { // removing last element assert ( m_listNodes . getField ( node , 1 ) == nullNode ( ) ) ; m_lists . setField ( list , 1 , nullNode ( ) ) ; } } freeNode_ ( node ) ; }
required because the list is singly connected ) .