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 <vector> | |
| #include <chrono> | |
| #include <iostream> | |
| #include <iterator> | |
| #include <algorithm> | |
| using namespace std; | |
| template<typename RandomAccessIterator1, typename RandomAccessIterator2> | |
| void merge_sort_impl(RandomAccessIterator1 source_begin, |
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
| def iterative_mergesort(arr): | |
| range_length = len(arr) | |
| if range_length < 2: | |
| return | |
| buf = [arr[i] for i in range(range_length)] | |
| runs = range_length | |
| merge_passes = get_number_of_merge_passes(runs) |
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.Arrays; | |
| import java.util.Collections; | |
| import java.util.List; | |
| public class Funky { | |
| private static final class Interval implements Comparable<Interval> { | |
| int min; | |
| int max; |
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 "linked_list.h" | |
| #include <stdlib.h> | |
| #include <stdio.h> | |
| void linked_list_init(linked_list_t* list) | |
| { | |
| list->head = NULL; | |
| list->tail = NULL; | |
| } |
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 "numberbag.hpp" | |
| #include <iostream> | |
| int main() { | |
| using coderodde::stat::number_bag; | |
| using namespace std; | |
| number_bag<float> bag; | |
| bag.add(1.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
| from heapq import heappush, heappop | |
| # This sort runs in O(n log k + k log k), | |
| # which simplifies to O(n log k) whenever k = o(n) | |
| # (k is sublinear in n). | |
| def window_heapsort(a, k): | |
| if k > len(a): | |
| return sorted(a) |
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
| \documentclass[12pt]{article} | |
| \usepackage{hyperref} | |
| \usepackage[utf8]{inputenc} | |
| \usepackage{tikz} | |
| \begin{document} | |
| \author{Rodion ``rodde'' Efremov} | |
| \title{Trying to get the gnuplot generated TikZ TeX to compile} | |
| \maketitle | |
| \begin{tikzpicture}[gnuplot] |
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.Arrays; | |
| import java.util.Random; | |
| public class Main { | |
| private static void merge(Comparable[] a, Comparable[] aux, int low, int mid, int high) { | |
| int i = low; | |
| int j = mid; |
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
| class TreeNode: | |
| def __init__(self, key): | |
| self.key = key | |
| self.left = None | |
| self.right = None | |
| def __eq__(self, other): |
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 <iostream> | |
| #include <iterator> | |
| #include <algorithm> | |
| #include <vector> | |
| #include <chrono> | |
| #include <cstdint> | |
| #include <random> | |
| void mergeSort(std::vector<int>::iterator begin, | |
| std::vector<int>::iterator end); |