快速排序草稿

package leet;

import java.util.HashMap;

public class longestSubstringWithoutRepeatingCharacters {

	static public int getAnswer(String input) {

		ListNode l1 = new ListNode(2);
		ListNode l2 = new ListNode(5);
		ListNode l3 = new ListNode(3);
		ListNode l4 = new ListNode(8);
		ListNode l5 = new ListNode(4);
		ListNode l6 = new ListNode(2);
		ListNode l7 = new ListNode(1);

		return maxLength;

	}

	public class ListNode {
		int val;
		ListNode next;

		ListNode(int x) {
			val = x;
		}
	}

	public ListNode sortList(ListNode head) {

		ListNode p1 = head;
		ListNode p2 = head.next;
		int tmp;
		while (null != p2.next) {

			if (head.val < p2.val) {
				p1 = p1.next;
				tmp = p1.val;
				p1.val = p2.val;
				p2.val = tmp;
			}

			p2 = p2.next;
		}

		tmp = p2.val;
		p2.val = head.val;
		head.val = tmp;

		sortList(head);
		sortList(p1);

		return head;

	}
}
原文地址:https://www.cnblogs.com/Jomini/p/11737502.html