I am solving the helpfree challenge in the main site "In-Place linked list reversing"

My problem is that I don't know what link list should I use. I made a simple one
Code:
```struct lilist{
int val;
lilist* node;
} ;
lilist* listinit(){
}
lilist* put(int p){

}

int get(bool f=false){
int ret=as->val;

if(as->node!= NULL)
as=as->node;
else return 0;
return ret;

}```
Is this enough for the challenge?

2. Can you do it without using any static variables or any globals?

Neither are very good if you want to make a list which is useful.

3. I think I can. But because challenge is not about making a link list, I don't want to wast my time on it. I only want to know if my LL functionality is enough for challenge or not.

4. Depends on how you plan to reverse it.

I guess you could try it as it stands, and see what happens.
If it doesn't work, at least you'll learn something.

5. Please read the challenge and tell me is this possible or not.
http://www.cprogramming.com/helpfree.html

6. Jeez, you could have done it by now and found the answer.

It's just another "will this work?" thread.
The answer being "why don't you spend 5 minutes finding out rather than wasting hours on a message board thread" (looks at clock - 1h45m gone already).

If I say "yes", and you can't do it, what are you going to do - blame me for bad advice ?

7. I don't know what an standard link list needs.

8. It needs a pointer to the next element in the list

9. If I understand "in-place" correctly, it would be a lot simpler with a double-linked list, where you should have a pointer to the previous node, too.

But maybe I misunderstand it and you can use the simple implementation.
Code:
```while node is not null
temp = node->next
node->next = othernode
othernode = node
node = temp
end while

10. It should be singly linked list.
I am going to build a more advanced link list, I will place it here.

11. This is my new linked list no globals no statics
Code:
```struct linklist{
int val;
} ;

}

if(pos>=0)
for(int i = 0; i<pos;i++)
else break;
else
}

}

}

int count=0;
count++;
}
return count;
}

int count=0;
count++;
}
return count;
}```

12. Here is the debugged version with a test code
Code:
```#include<iostream>
using namespace std;

int val;
} ;

}
int count=0;
count++;
}
return count;
}

if(pos>=0)
for(int i = 0; i<pos;i++)

else break;
else
}

}

if(pos>nCount) throw 1;
else {
}
}

int count=0;
count++;
}
return count;
}

int main(){

for(int i=0;i<10;i++) setNodeValue(hList,i);
int limit = getNodeCount(hList);

for(int i=0; i<limit/2;i++){
int p =getNodeValue(hList,limit-i-1);
setNodeValue(hList,getNodeValue(hList,i),limit-i-1);
setNodeValue(hList,p,i);
}

limit = getNodeCount(hList);
cout<<"After reverse"<<endl;
for(int i=0; i<limit;i++) cout<<getNodeValue(hList,i)<<endl;

cin.get();
return 0;
}```

13. The latest code seems to reverse the values in the list but leaves the nodes in place, which would be one way to reverse the values. To test your understanding of linked lists can you do it by switching nodes rather than values in nodes? For example, you could switch the first node with the last, the second node with the second to last node, the third node with the third to last node, etc.

for(i = 0; i < halfTheNodesInTheList; ++i)
FindNodeA
FindNodeB
SwitchNodesAandB

14. I did something:
Code:
```#include<iostream>
using namespace std;

int val;
} ;

}
int count=0;
count++;
}
return count;
}

if(pos>=0)
for(int i = 0; i<pos;i++)

else break;
else
}

}

if(pos>nCount) throw 1;
else {
}
}

cout<<node1<<"  "<<node2<<endl;
if(node1 > count || node2 >count){cout<<"if"<<endl; return NULL;}
else p1 = NULL;
else p2= NULL;
if(p1!=NULL && p2!=NULL && (p1 == n2 || p2 == n1)) {
p1->node=n1->node;
tmp=n2->node;
n2->node=n1;
n1->node=tmp;
}
else if(p1==NULL && p2!=NULL && (p1 == n2 || p2 == n1)){

tmp=n2->node;
n1->node=tmp;
return n2;

}
else if(p1!=NULL && p2==NULL && (p1 == n2 || p2 == n1)){
tmp=n1->node;
n2->node=tmp;
return n1;
}
else{
tmp= n1->node;
n1->node=n2->node;
n2->node= tmp;

if(p1!=NULL && p2!= NULL){
tmp=p1->node;
p1->node=p2->node;
p2->node=tmp;
}

else if(p1==NULL) {cout<<"NULL"<<endl;tmp= p2->node; p2->node=address; return tmp;}
else if(p2==NULL) {cout<<"NULL"<<endl;tmp= p1->node; p1->node=address; return tmp;}
else {cout<<"else"<<endl; return NULL;}
}

}
int count=0;
count++;
}
return count;
}

int main(){

for(int i=0;i<10;i++) setNodeValue(hList,i);
int limit = getNodeCount(hList);
for(int i=0; i<limit/2;i++){
int p =getNodeValue(hList,limit-i-1);
setNodeValue(hList,getNodeValue(hList,i),limit-i-1);
setNodeValue(hList,p,i);
}

limit = getNodeCount(hList);
cout<<"After reverse"<<endl;
cout<<endl;
for(int i=0; i<limit/2;i++){
if((hList = swapNodes(hList,i,limit-i-1)) == NULL) break;
}
cout<<endl;
hList = swapNodes(hList,0,1);