public static SingleNode partition2(SingleNode node, int x){
		SingleNode beforeStart=null;
		SingleNode afterStart=null;
		while(node!=null){
			SingleNode next=node.next;
			if((int)node.data<x){
				node.next=beforeStart;
				beforeStart=node;
			} else{
				node.next=afterStart;
				afterStart=node;
			}
			node=next;
		}
		if(beforeStart==null) return afterStart;
		SingleNode head=beforeStart;
		while(beforeStart.next!=null){
			beforeStart=beforeStart.next;
		}
		beforeStart.next=afterStart;
		return head;
	}