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
// | |
// Created by Cengiz Can on 01/07/15. | |
// | |
#include <stdio.h> | |
#include <ctype.h> | |
#include <stdlib.h> | |
void quit() { | |
perror("memory exhausted\n"); |
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
#include <stdio.h> | |
int num = 0; | |
#define JUMP printf("%d\n", ++num); | |
#define GO JUMP; JUMP | |
#define HIGHER GO; GO; GO; GO; GO | |
#define OH HIGHER; HIGHER | |
#define SING OH; OH; OH; OH; OH |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
// A utility function to print an array | |
void printArray(int stream[], int n) { | |
for (int i = 0; i < n; i++) { | |
printf("%d ", stream[i]); | |
} | |
printf("\n"); |
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
#include <stdlib.h> | |
#include <stdio.h> | |
void insertion_sort(int *source_array, int number_of_elements) { | |
int i, j, t; | |
for (i = 1; i < number_of_elements; i++) { | |
t = source_array[i]; |
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
#include <iostream> | |
#include <math.h> | |
using namespace std; | |
long findLargestPrimeFactor(long n) { | |
long squareRootOfN = (long) ceil(sqrt(n)); | |
long largestPrimeFactor = -1; | |
for (long i = 2; i <= squareRootOfN; i++) { |
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
#include <iostream> | |
#include <sstream> | |
using namespace std; | |
bool isPalindrome(int n) { | |
int reversedN = 0; | |
stringstream originalStr; | |
originalStr << n; |
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
#include <iostream> | |
using namespace std; | |
struct measure { | |
template<typename F, typename ...Args> | |
static void execution(F func, Args&&... args) { | |
auto start = chrono::system_clock::now(); | |
func(forward<Args>(args)...); | |
auto duration = chrono::system_clock::now() - start; |
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
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"sync" | |
"time" | |
) | |
var peopleGroup sync.WaitGroup |
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
#![feature(custom_derive, plugin)] | |
#![plugin(serde_macros)] | |
extern crate serde; | |
extern crate serde_json; | |
#[derive(Serialize, Deserialize, Debug)] | |
struct Point { | |
x: i32, | |
y: 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
#![feature(custom_derive, plugin)] | |
#![plugin(serde_macros)] | |
extern crate serde; | |
extern crate serde_json; | |
#[derive(Serialize, Deserialize, Debug)] | |
struct Point { | |
x: i32, | |
y: i32, |