Skip to content

Instantly share code, notes, and snippets.

View anish000kumar's full-sized avatar
🎯
Focusing

Anish Kumar anish000kumar

🎯
Focusing
  • Gurgaon, India
View GitHub Profile
@anish000kumar
anish000kumar / FenwickTree.js
Created June 4, 2021 05:39
FenwickTree Javascript implementation
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++)
@anish000kumar
anish000kumar / parentInOrder.js
Created August 28, 2021 04:32
inOrder traversal with parent pointer
function Node(value, parent = null){
this.value = value
this.left = null
this.right = null
this.parent = parent
}
// create tree
@anish000kumar
anish000kumar / parentPreOrder.js
Created August 28, 2021 04:33
PreOrder traversal using parent pointer
function Node(value, parent = null){
this.value = value
this.left = null
this.right = null
this.parent = parent
}
// create tree
@anish000kumar
anish000kumar / parentPostOrder.js
Last active August 28, 2021 05:29
PostOrder traversal using parent pointer
function Node(value, parent = null){
this.value = value
this.left = null
this.right = null
this.parent = parent
}
// create tree
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();