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
const fs = require("fs"), | |
names = fs.readFileSync("./names.txt").toString().split("\r\n"), | |
noOfStudents = names.length, | |
studentsPerGroup = 6, | |
noOfGroups = Math.ceil(noOfStudents / studentsPerGroup) | |
let groups = [] | |
for (i = 0; i < noOfGroups; i++) { | |
groups.push([]) |
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
//https://twitter.com/fermatslibrary/status/937687947041701888 | |
use std::{thread, time}; | |
use std::sync::{Arc, Barrier}; | |
fn main() { | |
let elements = vec![9,8,7,6,5,4,3,2,1,0]; | |
sleep_sort(elements); | |
} | |
fn sleep_sort(dataset: Vec<i32>) { |
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
/* | |
* I was reading about Carl Friedrich Gauss's anecdote of how he summed up 1 to 100 | |
* in an interesting manner. So, I wanted to make it with a loop (I know, I am a | |
* lazy guy) and came up with this pretty quickly... so quickly that I thought I did | |
* it wrong but the output was same as the great mathematician. But I think that | |
* there is some another and easy way to do this, right? | |
*/ | |
#include <stdio.h> |