Skip to content

Commit 6c9fe8f

Browse files
committed
Cleanup
1 parent 9557bca commit 6c9fe8f

1 file changed

Lines changed: 2 additions & 21 deletions

File tree

binary-tree/tree.js

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class Tree {
33
addValue(value) {
44
if (!this.number) {
55
this.number = value
6-
this.branchIndex = 0
6+
this.nodeIndex = 0
77
} else {
88
if (this.valueIndex) this.valueIndex += 1
99
else this.valueIndex = 1
@@ -24,7 +24,7 @@ class Tree {
2424
class Branch {
2525
constructor(value, index) {
2626
this.number = value
27-
this.branchIndex = index
27+
this.nodeIndex = index
2828
}
2929
addValue(value, index) {
3030
// right, higher
@@ -39,22 +39,3 @@ class Branch {
3939
}
4040
}
4141
}
42-
43-
/*
44-
branch (nr, index)
45-
-> inaczej
46-
-> sprawdź czy pasuje do lewego brancha (mniejszy niż numer)
47-
-> nie, to wstaw numerem i indexem
48-
-> tak, to wrzuć nowy branch, który stworzy nowy branch
49-
-> sprawdź czy pasuje do prawego brancha (wiekszy niż numer)
50-
-> nie, to wstaw nowy branch z numerem
51-
-> tak, to wrzuć nowy branch, który stworzy nowy branch
52-
*/
53-
54-
// let tree = new Tree()
55-
56-
// for (let i = 0; i < 15; i++) {
57-
// tree.addValue(Math.floor(Math.random() * 101))
58-
// }
59-
60-
// console.log(JSON.stringify(tree, null, 2))

0 commit comments

Comments
 (0)