added reverse k nodes algo