C++,用vector存储整个链表
重排链表
http://www.nowcoder.com/practice/3d281dc0b3704347846a110bf561ef6b
if (head == NULL || head->next == NULL || head->next->next == NULL)
return;
vector<ListNode *> v;
while(head!=NULL){
v.emplace_back(head);
head=head->next;
}
int i=0,j=v.size()-1;
while(i<j){
v.at(i)->next=v.at(j);
++i;
if(i==j)
break;
v.at(j)->next=v.at(i);
--j;
}
v.at(i)->next=NULL;