Skip to content

Commit 9e67aba

Browse files
committed
add comments on b-tree
1 parent 146b2fd commit 9e67aba

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

BTree/src/BTree.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ public static BTree leftMostNode(BTree node) {
255255
return node;
256256
}
257257

258+
// left, root, right
258259
public static BTree inorderSuc(BTree root, int k) {
259260
if (root == null)
260261
return null;
@@ -282,7 +283,7 @@ public static BTree inorderSuc(BTree root, int k) {
282283

283284
}
284285
}
285-
286+
//root, left, right
286287
public static BTree preorderSuc(BTree node, int k) {
287288
if (node == null)
288289
return null;
@@ -322,7 +323,7 @@ else if (node.right != null)
322323

323324

324325
}
325-
326+
// left, right, root
326327
public static BTree postorderSuc(BTree root, int k) {
327328
if (root == null)
328329
return null;

PuzzleCoding/src/MergeSortedArray.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ private void shiftDown(int k) {
6868
while (2 * k <= heap.size() - 1) {
6969
int i = 2 * k; //left
7070
int j = i + 1; //right
71+
//find the smallest of left and right
7172
if (i < heap.size() - 1 && greater(i, j)) {
7273
i++;
7374
}

StringOps/src/StringOps.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public static String rotateString(String s, int k) {
204204
}
205205

206206
public static boolean isRexMatch(String s1, String s2) {
207-
if (s1 == null || s1.isEmpty() || s2 == null) return false;
207+
if (s1 == null || s2 == null) return false;
208208
if (s2.isEmpty()) return s2.isEmpty(); // "" , ""
209209

210210

0 commit comments

Comments
 (0)