This file contains hidden or 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 net.coderodde.util; | |
| import java.util.Random; | |
| /** | |
| * This class contains static methods for sorting {@code byte} arrays. | |
| * | |
| * @author Rodion "rodde" Efremov | |
| * @version 1.6 (Apr 24, 2019) | |
| */ |
This file contains hidden or 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 net.coderodde.util; | |
| import java.util.Random; | |
| /** | |
| * This class contains a method for converting {@code long} values to strings. | |
| * | |
| * @author Rodion "rodde" Efremov | |
| * @version 1.6 (May 13, 2019) | |
| */ |
This file contains hidden or 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 "semaphore_impl.h" | |
| #include <windows.h> | |
| static const char* CLASS = "net/coderodde/util/concurrent/WindowsSemaphoreImpl"; | |
| static const char* FIELD = "semaphoreHandle"; | |
| static HANDLE get_semaphore_handle(JNIEnv* env, jobject obj) | |
| { | |
| jclass clazz = env->FindClass(CLASS); | |
| jfieldID fid = env->GetFieldID(clazz, FIELD, "J"); |
This file contains hidden or 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 "dt_tag_entry.hpp" | |
| #include <string> | |
| #include <utility> | |
| namespace net { | |
| namespace coderodde { | |
| namespace dt2 { | |
| TagEntry::TagEntry(std::string const& tag, | |
| std::string const& directory) |
This file contains hidden or 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 copy | |
| import random | |
| import time | |
| from heapq import heappush, heappop | |
| class Country: | |
| def __init__(self, name, resources): | |
| self.name = name |
This file contains hidden or 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 "parallel_for.h" | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <time.h> | |
| #if defined(__APPLE__) || defined(__linux__) | |
| #define POSIX | |
| #endif | |
| #if defined(POSIX) |
This file contains hidden or 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 "parallel_for.h" | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #if defined(__APPLE__) | |
| #include <sys/time.h> | |
| #elif defined(__linux__) | |
| #include <sys/time.h> | |
| #elif defined(_WIN32) | |
| #include <windows.h> | |
| #else |
This file contains hidden or 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 net.coderodde.boundaries; | |
| import java.util.ArrayList; | |
| import java.util.Random; | |
| /** | |
| * This class implements a benchmark for the boundary algorithms. | |
| * | |
| * @author Rodion "rodde" Efremov | |
| * @version 1.6 (Dec 1, 2017) |
This file contains hidden or 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 net.coderodde.util; | |
| import java.util.Random; | |
| public class IntegerPatternMatching { | |
| public static int getSubArrayIndex(int[] parentArr, int[] subArr) { | |
| boolean found = false; | |
| for (int i = 0; i <= parentArr.length - subArr.length; i++) { | |
| if (parentArr[i] == subArr[0]) { |
This file contains hidden or 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.ArrayList; | |
| import java.util.Arrays; | |
| import java.util.Iterator; | |
| import java.util.List; | |
| import java.util.NoSuchElementException; | |
| import java.util.Objects; | |
| public final class TupleIterable<T> implements Iterable<List<T>> { |