Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit819d6f9

Browse files
committed
No need the maxHeight
1 parent0079d4d commit819d6f9

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

‎test/data-structures/size-balanced-tree.spec.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,11 @@ describe('SBTree', function () {
104104
sTree.push(i);
105105
}
106106
checkNil();
107-
varmaxHeight=0;
108107
for(vari=0;i<2000000;++i){
109108
varnode=sTree.get(i);
110-
maxHeight=Math.max(maxHeight,node.height);
111109
expect(node.value).toBe(i);
112110
}
113-
expect(maxHeight).toBe(21);
111+
expect(sTree._root.height).toBe(21);
114112
for(vari=0;i<2000000;++i){
115113
expect(sTree.get(0).value).toBe(i);
116114
varnode=sTree.remove(0);// Always remove the first element;
@@ -135,24 +133,21 @@ describe('SBTree', function () {
135133
expectedArray.splice(newPos,0,i);
136134
}
137135
expect(sTree.size).toBe(expectedArray.length);
138-
maxHeight=0;
139136
for(vari=0;i<sTree.size;++i){
140137
varnode=sTree.get(i);
141-
maxHeight=Math.max(maxHeight,node.height);
142138
expect(node.value).toBe(expectedArray[i]);
143139
}
144-
console.log(maxHeight);
140+
console.log(sTree._root.height);
145141
for(vari=0;i<90000;++i){
146142
varremovedPos=getRandomInt(0,sTree.size);
147143
sTree.remove(removedPos);
148144
expectedArray.splice(removedPos,1);
149145
}
150146
for(vari=0;i<sTree.size;++i){
151147
varnode=sTree.get(i);
152-
maxHeight=Math.max(maxHeight,node.height);
153148
expect(node.value).toBe(expectedArray[i]);
154149
}
155-
console.log(maxHeight);
150+
console.log(sTree._root.height);
156151
checkNil();
157152
});
158153
});

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp