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 oneIs this enough for the challenge?Code:struct lilist{ int val; lilist* node; } ; lilist *fad; lilist* listinit(){ fad=new lilist; return fad; } lilist* put(int p){ static lilist *ad=fad; ad->val=p; ad->node=new lilist; ad->node->node=NULL; //cout<<ad<<" "<<ad->node<<endl; ad=ad->node; return ad->node; } int get(bool f=false){ static lilist* as = fad; if(f) {as=fad; return 0;} int ret=as->val; if(as->node!= NULL) as=as->node; else return 0; return ret; }



LinkBack URL
About LinkBacks



CornedBee