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 BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Diagnosers; | |
using System; | |
using System.Text; | |
[MemoryDiagnoser] | |
public class Benchmarks | |
{ | |
StringBuilder builder = new StringBuilder(); |
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
// visit https://benchmarkdotnet.org/ for more info on BenchmarkDotNet | |
using System.Numerics; | |
using System.Runtime.CompilerServices; | |
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Diagnosers; | |
[CategoriesColumn] | |
public class Benchmarks | |
{ |
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.Buffers; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace SegmentsPathString | |
{ | |
internal static class PathHelpers |
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
from collections import deque | |
# When you open LinkedIn profile, it displays a number that shows how closely | |
# you're connected to that person. | |
# 1st degree connection are people you're directly connected with | |
# 2nd degree connections are people who are connected to your first degree connections | |
# 3rd degree connections are people who are connected to your 2nd degree connections | |
# etc. |
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 MegaArray { | |
constructor() { | |
this._arrays = []; | |
this._size = 0; | |
} | |
push(item) { | |
const array = this._getActiveArray(); |
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 multiprocessing | |
import threading | |
import time | |
import random | |
import math | |
def io_thread_run(val): | |
time.sleep(1) | |
while True: | |
print("thread ", val) |
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 multiprocessing | |
import threading | |
import time | |
def thread_runner(val): | |
while True: | |
print("thread ", val) | |
num_cpus = multiprocessing.cpu_count() |
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
#!/usr/bin/python3 | |
# this program verifies implementation of the map operation by checking | |
# the output results (intermediate_files and final result files) of the map reduce | |
# counter program against the specified input files | |
import os | |
import sys | |
import re | |
from collections import Counter |
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
const hasAtMostOneAllowedKey = (arg, allowedKeys) => { | |
const [firstKey, ...otherKeys] = allowedKeys; | |
if (!firstKey) { | |
return true; | |
} | |
if (firstKey in arg) { | |
return !otherKeys.some(otherKey => otherKey in arg); | |
} | |
else { | |
return hasAtMostOneAllowedKey(arg, otherKeys); |