Few of the general algos in NodeJS