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
enum RockPaperScissorsChoice | |
{ | |
Rock = 1, | |
Paper = 2, | |
Scissors = 4 | |
} | |
static string DescribeRockPaperScissorsResult(RockPaperScissorsChoice first, RockPaperScissorsChoice second) | |
{ | |
if (first == second) |
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
using System; | |
namespace test | |
{ | |
class PureObjectOrientedWorld | |
{ | |
static void Main(string[] args) | |
{ | |
var p = new PureObjectOrientedWorld(); | |
p.Test(5, 12, 12); |
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
class Utility { | |
class LinkedListNode<T> | |
{ | |
public T Value; | |
public LinkedListNode<T> Next; | |
} | |
static bool IsEven(int n) | |
{ | |
// Create a circular linked list with 2 nodes. | |
var even = new LinkedListNode<bool>() { Value = true }; |
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
using System; | |
using System.Diagnostics; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace MonteCarloPi | |
{ | |
class Demo | |
{ | |
static void Main(string[] args) |
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
import java.util.Random; | |
import java.util.concurrent.ExecutionException; | |
import java.util.concurrent.ForkJoinPool; | |
import java.util.concurrent.ForkJoinTask; | |
import java.util.concurrent.TimeUnit; | |
public class Main { | |
public static void main(String[] args) { | |
double sequentialTime = 1; |
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 <stdbool.h> | |
#include <string.h> | |
bool getMimeType(const char* filePath, char* output, int maxOutputLength) { | |
const char* COMMAND_BASE = "/usr/bin/file -b --mime-type "; | |
// + 1 for null terminator | |
char* command = calloc(1, strlen(COMMAND_BASE) + strlen(filePath) + 1); |
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
Parallel took: 00:00:00.4485898 | |
Sequential took: 00:00:11.0775119 | |
Parallel speedup: 24.69x |