链表快排
func sortList(head *ListNode) *ListNode { slist(head,nil) return head } func slist(head *ListNode,tail *ListNode){ if head == nil || head.Next == nil || head == tail{ return } pivot := head.Val i := head var j *ListNode for j = head.Next;j != tail;j = j.Next { if j.Val < pivot { i = i.Next temp := j.Val j.Val = i.Val i.Val = temp } } temp := i.Val i.Val = head.Val head.Val = temp slist(head,i) slist(i.Next,j) }