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
def chunk(xs, n): | |
""" Split an iterable into chunks. | |
Parameters | |
---------- | |
xs : iterable | |
Iterable to be split. | |
n : int | |
Chunk size. |
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 "btree.h" | |
template <typename T> | |
void Btree<T>::insert(const T &x) { | |
if (root == nullptr) { | |
node_ptr node = std::make_unique<Node>(x); | |
root = std::move(node); | |
return; | |
} |
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/env python3 | |
""" Binary search tree with method to invert in-place. """ | |
class Node(object): | |
def __init__(self, x): | |
self.value = x | |
self.left = None | |
self.right = None |
NewerOlder