Popular Posts

Friday, March 18, 2011

Reverse alternate k nodes in a linked list


Given a linked list, write a function to reverse every alternate k nodes (where k is an input to the function) in an efficient way. Give the complexity of your algorithm.
Example:
Inputs: 1->2->3->4->5->6->7->8->9->NULL and k = 3
Output: 3->2->1->4->5->6->9->8->7->NULL.


http://geeksforgeeks.org/?p=11371

1 comment:

  1. similar post :

    http://tech-queries.blogspot.com/2010/03/swap-adjacent-element-in-link-list.html

    ReplyDelete