Implemented deleteMiddle and partition