Skip to content

Instantly share code, notes, and snippets.

View heyrutvik's full-sized avatar

Rutvik Patel heyrutvik

View GitHub Profile
@heyrutvik
heyrutvik / executor_future_poll_waker.rs
Last active January 18, 2023 16:44
The dance of polling and waking in Rust!
// Cargo.toml
//
// [dependencies]
// futures = "0.3.25"
use std::future::Future;
use std::ops::Deref;
use std::pin::Pin;
use std::sync::{Arc, Mutex};
use std::sync::mpsc::{Receiver, sync_channel, SyncSender};
@heyrutvik
heyrutvik / aa-tree.scala
Last active July 3, 2024 05:30
Implementation of AA Tree
package ds.tree.aa
import scala.annotation.tailrec
// https://en.wikipedia.org/wiki/AA_tree
sealed trait Tree
final case class Node(var key: Int, var level: Int, var left: Tree, var right: Tree) extends Tree