Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
#include <vector>
#include <bitset>
#include <math.h>
#include <climits>
using namespace std;
/*
static string ToBinaryString(float value) {
#include <iostream>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <sstream>
#include <climits>
#include <bits/stdc++.h>
using namespace std;
// Compiled with: g++ -Wall -std=c++14 -pthread
#include <iostream>
#include <vector>
#include <map>
using namespace std;
//print array
void print(int* arr, int n) {
@bexp
bexp / merge.cc
Last active May 14, 2018 20:24
merge sort
#include <iostream>
#include <map>
using namespace std;
void print(int *a, int num) {
for (int i = 0; i < num; i++) {
cout << " " << a[i];
}
/*
* Simple lockfree implementation of single producer/consumer circular FIFO buffer
*/
#ifndef RINGBUFFER_H
#define RINGBUFFER_H
#include <algorithm>
#include <memory.h>
#include <atomic>
@bexp
bexp / cons.cc
Last active July 11, 2018 18:37
consumer_producer
// Compiled with: g++ -Wall -std=c++14 -pthread
#include <iostream>
#include <mutex>
#include <thread>
#include <condition_variable>
#include <queue>
#include <thread>
#include <vector>
using namespace std;