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 <functional> | |
#include <iostream> | |
#include <stdexcept> | |
#include <string> | |
template <typename Key, typename Value> | |
class HashTable { | |
public: | |
using size_t = unsigned long; | |
using HashFunction = std::function<size_t(const Key&)>; |
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 <cassert> | |
#include <iostream> | |
template <typename T> | |
class ListQueue { | |
public: | |
using size_t = unsigned long; | |
ListQueue() : _head(nullptr), _tail(nullptr), _size(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
#include <cassert> | |
#include <iostream> | |
template <typename T> | |
class ArrayStack { | |
public: | |
using size_t = unsigned long; | |
static constexpr size_t MINIMUM_CAPACITY = 8; | |
static constexpr size_t GROWTH_FACTOR = 2; |
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 <algorithm> | |
#include <cassert> | |
#include <cstddef> | |
#include <functional> | |
#include <iostream> | |
#include <unordered_map> | |
#include <vector> | |
template <typename T> | |
class BinomialHeap { |
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
# Path to your oh-my-zsh installation. | |
export ZSH=/Users/goldsborough/.oh-my-zsh | |
# Set name of the theme to load. | |
# Look in ~/.oh-my-zsh/themes/ | |
# Optionally, if you set this to "random", it'll load a random theme each | |
# time that oh-my-zsh is loaded. | |
ZSH_THEME="agnoster" | |
# Uncomment the following line to use case-sensitive completion. |
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
@mixin media-query($type) { | |
@if $type == phone { | |
@media only screen and (min-width: 320px) { | |
@content; | |
} | |
} @else if $type == tablet { | |
@media only screen and (min-width: 768px) { | |
@content; | |
} | |
} @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
@function swap($list, $first, $second) { | |
@if ($first == $second) { | |
@return $list; | |
} | |
$temp: nth($list, $first); | |
$list: set-nth($list, $first, nth($list, $second)); | |
$list: set-nth($list, $second, $temp); | |
@return $list; | |
} |
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 benchmark(function): | |
""" | |
Registers a function for benchmarking. | |
Args: | |
function (func): The function to benchmark. | |
Returns: | |
A new function with benchmarking functionality. | |
""" |
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 enable_timeit(number=1000, repeat=1): | |
""" | |
Adds a `timeit` member function to the decorated function. | |
This function allows for configuration of how `timeit` will be executed for | |
the decorated function. Note that ultimately, `timeit.repeat()` will be | |
called, not `timeit.timeit()`. | |
Args: | |
number (int): How often `timeit` should execute the function. |
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 heap | |
type Heap struct { | |
data []int | |
compare func(int, int) bool | |
} | |
func New() *Heap { | |
return &Heap{ | |
data: []int{-1}, |