@snuffles
2015-04-05T02:32:34.000000Z
字数 550
阅读 1046
leetcode
20150405
1.initialization from incompatible pointer type
2.指针的用法
3.改用C实现
use this code to ac
the learning point of this problem to read
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* struct ListNode *next;
* };
*/
struct ListNode *partition(struct ListNode *head, int x)
{
struct Listnode *small=head;
struct Listnode *big=head;
struct Listnode *key=head;
for(;key!=NULL;key=key->next){
if(key->val<x){
small->val=key->val;
small=key->next;
}
}
big=small->next=big;
key=head;
for(;key!=NULL;key=key->next){
if(key->val>=x){
big->val=key->val;
big=key->next;
}
}
return head;
}