Instantly share code, notes, and snippets.

View concat-string.rs
extern crate nix;
use std::ffi::CString;
use std::ptr::write;
use nix::libc::{free, malloc, strlen};
fn main() {
let c_str1 = CString::new("Hello, ").unwrap();
let c_str2 = CString::new("world!").unwrap();
View find_maximum.go
package main
import "fmt"
func main() {
a := []int{5, 3, 3, 4, 5}
fmt.Println(findMaximum(a, 0, 4))
}
func findMaximum(A []int, left, right int) int {
View popcnt.go
package main
// Hamming weight algorithm
// https://en.wikipedia.org/wiki/Hamming_weight
const m1 = 0x5555555555555555
const m2 = 0x3333333333333333
const m4 = 0x0f0f0f0f0f0f0f0f
const h01 = 0x0101010101010101
View queue_handler.go
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
View calc_by_stack.go
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
View shell_sort.go
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
View stable_sort.go
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
View selection_sort.go
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
View bubble_sort.go
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
View insertion_sort.go
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)