This file contains 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
// [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 = () => { |
This file contains 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 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; |