int deleteElement ( int list , int node ) { int prev = getPrev ( node ) ; int next = getNext ( node ) ; if ( prev != nullNode ( ) ) setNext_ ( prev , next ) ; else m_lists . setField ( list , 0 , next ) ; // change head if ( next != nullNode ( ) ) setPrev_ ( next , prev ) ; else m_lists . setField ( list , 1 , prev ) ; // change tail freeNode_ ( node ) ; setListSize_ ( list , getListSize ( list ) - 1 ) ; return next ; }
Deletes a node from a list . Returns the next node after the deleted one .