Skip to content

Instantly share code, notes, and snippets.

// [rust] run with `rustc main.rs && ./main`
fn main() {
for n in 4..20 {
let t = (2*n) as f64 / 3 as f64;
println!("{} of {}", t.ceil(), n);
}
}
// [javascript] run with `node main.js`
const fn = () => {
/** @class representing a binary heap node */
class Node {
/**
* @author: xenowits
* @param {string} id The accountID of the user
* @param {number} wt The associated weight (equal to noOfEntries)
* @param {number} totalWt Total weight of the subheap headed by current Node
*/
constructor(id, wt, totalWt) {
this.accountID = id;