Skip to content

Commit

Permalink
remove loitering bug in BTree.java
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-wayne committed Aug 2, 2020
1 parent 1f90594 commit 922bb05
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/edu/princeton/cs/algs4/BTree.java
Expand Up @@ -67,7 +67,7 @@ private Node(int k) {
// external nodes: only use key and value
private static class Entry {
private Comparable key;
private final Object val;
private Object val;
private Node next; // helper field to iterate over array entries
public Entry(Comparable key, Object val, Node next) {
this.key = key;
Expand Down Expand Up @@ -184,6 +184,7 @@ private Node insert(Node h, Key key, Value val, int ht) {
Node u = insert(h.children[j++].next, key, val, ht-1);
if (u == null) return null;
t.key = u.children[0].key;
t.val = null;
t.next = u;
break;
}
Expand Down

0 comments on commit 922bb05

Please sign in to comment.