@@ -0,0 +1,1492 @@
+package leetcode.convert_sorted_list_to_binary_search_tree;%0A%0Aimport common.ListNode;%0Aimport common.TreeNode;%0A%0Apublic class Solution %7B%0A%09public TreeNode sortedListToBST(ListNode head, ListNode end) %7B%0A%09%09if(head == end) return null;%0A%09%09ListNode hare = head.next;%0A%09%09ListNode tortoise = head;%0A%09%09while(hare != end)%7B%0A%09%09%09hare = hare.next;%0A%09%09%09if(hare != end)%7B%0A%09%09%09%09hare = hare.next;%0A%09%09%09%7D%0A%09%09%09tortoise = tortoise.next;%0A%09%09%7D%0A%09%09TreeNode root = new TreeNode(tortoise.val);%0A%09%09root.left = sortedListToBST(head, tortoise);%0A%09%09root.right = sortedListToBST(tortoise.next, end);%0A%09%09return root;%0A%09%7D%0A%09%0A    public TreeNode sortedListToBST(ListNode head) %7B%0A        if(head == null) return null;%0A        return sortedListToBST(head, null);%0A    %7D%0A    %0A    public static void inOrder(TreeNode node)%7B%0A    %09if(node != null)%7B%0A    %09%09inOrder(node.left);%0A    %09%09System.err.print(node.val + %22 %22);%0A    %09%09inOrder(node.right);%0A    %09%7D%0A    %7D%0A    %0A    public static void preOrder(TreeNode node)%7B%0A    %09if(node != null)%7B%0A    %09%09System.err.print(node.val + %22 %22);%0A    %09%09preOrder(node.left);%0A    %09%09preOrder(node.right);%0A    %09%7D%0A    %7D%0A    %0A    public static void main(String%5B%5D args)%7B%0A    %09final int N = 15;%0A    %09ListNode%5B%5D list = new ListNode%5BN%5D;%0A    %09for(int i = 0; i %3C N; i++)%7B%0A    %09%09list%5Bi%5D = new ListNode(i);%0A    %09%09if(i %3E 0) list%5Bi - 1%5D.next = list%5Bi%5D;%0A    %09%7D%0A    %09%0A    %09inOrder(new Solution().sortedListToBST(list%5B0%5D));%0A    %09System.err.println(%22%22);%0A    %09preOrder(new Solution().sortedListToBST(list%5B0%5D));%0A    %09System.err.println(%22%22);%0A    %7D%0A%7D%0A

Add java solution for 109. Convert Sorted List to Binary Search Tree