Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Node *findMToLastNode( Node *head, int m){
- Node *cur=head;
- Node *mBehind=NULL;
- int i;
- for (i=0;i<m;i++){
- if (cur->next){
- cur=cur->next;
- }
- else{
- return mBehind;
- }
- }
- mBehind=head;
- while(cur->next){
- cur=cur->next;
- mBehind=mBehind->next;
- }
- return mBehind;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement