This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class FenwickTree{ | |
| constructor(array){ | |
| this.source = [...array] | |
| this.length = this.source.length; | |
| this.fenwick = new Array(array.length+1).fill(0) | |
| this.build(); | |
| } | |
| build(){ | |
| for(let i = 0; i < this.length; i++) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Node(value, parent = null){ | |
| this.value = value | |
| this.left = null | |
| this.right = null | |
| this.parent = parent | |
| } | |
| // create tree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Node(value, parent = null){ | |
| this.value = value | |
| this.left = null | |
| this.right = null | |
| this.parent = parent | |
| } | |
| // create tree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Node(value, parent = null){ | |
| this.value = value | |
| this.left = null | |
| this.right = null | |
| this.parent = parent | |
| } | |
| // create tree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import puppeteer, { Browser, ElementHandle, Page } from "puppeteer"; | |
| export async function getPageHandler(url, openPage, delayMillis, headless = false) { | |
| const openBrowser = await puppeteer.launch({ | |
| headless, | |
| }); | |
| let page; | |
| if(!openPage){ | |
| page = await openBrowser.newPage(); |
OlderNewer