mirror of
https://github.com/zrwusa/data-structure-typed.git
synced 2024-11-23 12:54:04 +00:00
52 lines
1 KiB
HTML
52 lines
1 KiB
HTML
<!DOCTYPE html>
|
|
<html lang='en'>
|
|
<head>
|
|
<meta charset='UTF-8'>
|
|
<title>CDN Test</title>
|
|
<script src='https://cdn.jsdelivr.net/npm/data-structure-typed/dist/umd/data-structure-typed.min.js'></script>
|
|
</head>
|
|
<body>
|
|
<div id='app'>
|
|
<ul class='modules'>
|
|
|
|
</ul>
|
|
</div>
|
|
<script defer>
|
|
const $modules = document.querySelector('.modules');
|
|
|
|
|
|
try {
|
|
const {AVLTree, Queue} = window.dataStructureTyped;
|
|
const avlTree = new AVLTree();
|
|
const $avlTree = document.createElement('li');
|
|
const $avlTreeSpan = document.createElement('span');
|
|
$avlTreeSpan.innerText = 'AVLTree';
|
|
$avlTree.append($avlTreeSpan);
|
|
avlTree.add(1, 1);
|
|
console.log(avlTree.bfs());
|
|
$modules.append($avlTree);
|
|
|
|
|
|
const queue = new Queue();
|
|
for (let i = 0; i < 1000000; i++) {
|
|
queue.enqueue(i);
|
|
}
|
|
let last = 0;
|
|
const startTime = performance.now();
|
|
|
|
for (let i = 0; i < 1000000; i++) {
|
|
last = queue.dequeue();
|
|
}
|
|
|
|
console.log(performance.now() - startTime);
|
|
|
|
} catch (e) {
|
|
console.error(e);
|
|
}
|
|
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|
|
|