Stack I used https://github.com/bishil06/data_structure/blob/main/src/stack/Stack.js
- convert infix notation to postfix notation
- operator push stack
- calculate
function *range(start=0, stop, step=1) { | |
while(start < stop) { | |
yield start; | |
start+=step; | |
} | |
} | |
console.log(...range(0, 5)); // 0 1 2 3 4 | |
console.log(...range(0, 10, 2)); // 0 2 4 6 8 | |
console.log(...range(1, 20, 3)); // 1 4 7 10 13 16 19 |
function *enumerate(init=0, iter) { | |
if (init[Symbol.iterator]) { | |
iter = init[Symbol.iterator](); | |
init = 0; | |
} | |
let count = init; | |
for(const a of iter) { | |
yield [count, a]; | |
count += 1; |
function *zip(iter1, iter2) { | |
const a = iter1[Symbol.iterator](); | |
const b = iter2[Symbol.iterator](); | |
let va = null; | |
let vb = null; | |
while (!((va = a.next()).done) && !((vb = b.next()).done)) { | |
yield [va.value, vb.value]; | |
} | |
} |
Stack I used https://github.com/bishil06/data_structure/blob/main/src/stack/Stack.js
const crypto = require('crypto'); | |
function createMD5(filePath) { | |
return new Promise((res, rej) => { | |
const hash = crypto.createHash('md5'); | |
const rStream = fs.createReadStream(filePath); | |
rStream.on('data', (data) => { | |
hash.update(data); | |
}); |