修改包的名字

This commit is contained in:
YuCheng Hu 2018-12-26 17:38:00 -05:00
parent 96ea15ef65
commit 853a073b65
7 changed files with 36 additions and 91 deletions

View File

@ -1,4 +1,4 @@
package com.ossez.lang.tutorial; package com.ossez.codebank.algorithm;
import java.util.Properties; import java.util.Properties;

View File

@ -1,16 +1,16 @@
package com.ossez.lang.tutorial.models; package com.ossez.codebank.algorithm.models;
/** /**
* *
* @author YuCheng * @author YuCheng
* *
*/ */
public class ListNode { public class ListNode {
public int val; public int val;
public ListNode next; public ListNode next;
public ListNode(int x) { public ListNode(int x) {
val = x; val = x;
next = null; next = null;
} }
} }

View File

@ -1,16 +1,16 @@
package com.ossez.lang.tutorial.models; package com.ossez.codebank.algorithm.models;
/** /**
* *
* @author YuCheng * @author YuCheng
* *
*/ */
public class TreeNode { public class TreeNode {
public int val; public int val;
public TreeNode left, right; public TreeNode left, right;
public TreeNode(int val) { public TreeNode(int val) {
this.val = val; this.val = val;
this.left = this.right = null; this.left = this.right = null;
} }
} }

View File

@ -1,4 +1,4 @@
package com.ossez.lang.tutorial.objplusclass; package com.ossez.codebank.algorithm.objplusclass;
/** /**
* *

View File

@ -1,4 +1,4 @@
package com.ossez.lang.tutorial.overview; package com.ossez.codebank.algorithm.overview;
/** /**
* Java Tutorial * Java Tutorial

View File

@ -1,4 +1,4 @@
package com.ossez.lang.tutorial.overview; package com.ossez.codebank.algorithm.overview;
/** /**
* Java Tutorial * Java Tutorial

View File

@ -1,55 +0,0 @@
package com.ossez.lang.tutorial.utils;
import java.util.ArrayList;
import com.ossez.lang.tutorial.models.TreeNode;
/**
*
* @author YuCheng
*
*/
public class TreeUtils {
public static TreeNode initTree(String data) {
// NULL CHECK
if (data.equals("{}")) {
return null;
}
ArrayList<TreeNode> treeList = new ArrayList<TreeNode>();
data = data.replace("{", "");
data = data.replace("}", "");
String[] vals = data.split(",");
// INSERT ROOT
TreeNode root = new TreeNode(Integer.parseInt(vals[0]));
treeList.add(root);
int index = 0;
boolean isLeftChild = true;
for (int i = 1; i < vals.length; i++) {
if (!vals[i].equals("#")) {
TreeNode node = new TreeNode(Integer.parseInt(vals[i]));
if (isLeftChild) {
treeList.get(index).left = node;
} else {
treeList.get(index).right = node;
}
treeList.add(node);
}
// LEVEL
if (!isLeftChild) {
index++;
}
// MOVE TO RIGHT OR NEXT LEVEL
isLeftChild = !isLeftChild;
}
return root;
}
}