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
template <typename T> | |
void SortAlg<T>::insertionSort(typename vector<T>::iterator s, | |
typename vector<T>::iterator e) { | |
typename vector<T>::iterator i, j; | |
for (i = s + 1; i < e; i++) for (j = i; j > s && *(j - 1) > *j; j--) iter_swap(j, j - 1); | |
} |
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
/* | |
* ============ | |
* Alphabetizer | |
* ============ | |
* | |
* File: AlphaTesting.cpp | |
* ---------------------- | |
* This file contains the AlphaTesting class to unit test each function in | |
* Alphabetizer | |
* |
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
; Patches struct | |
patches-own [ | |
exists? | |
neighbor-count | |
] | |
; Initialize patches and turtles | |
to setup | |
clear-all | |
ask patches [ erase ] |
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
(fn '(zeros n) '(if n '(cons 0 (zeros (- n 1))) '('()))) | |
(fn '(cantor-2 depth) | |
'(if depth | |
'((\ '(x) '(join x (zeros (len x)) x))(cantor-2 (- depth 1))) | |
'('(1)))) |
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 csv | |
class Tagged(object): | |
def __init__(self, data, tags): | |
assert len(data[0]) == len(tags) | |
self.data = data | |
self.tags = tags |
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 csv | |
import pymysql.cursors | |
connection = pymysql.connect(host='localhost', | |
user='root', | |
password='wpbvre999', | |
db='cs490', | |
charset='utf8mb4', | |
cursorclass=pymysql.cursors.DictCursor) |
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
CREATE TABLE `space_ship` ( | |
`name` varchar(128) NOT NULL, | |
`seq_num` bigint(20) NOT NULL, | |
`country` varchar(128) NOT NULL, | |
`captain` varchar(128), | |
`flight` timestamp, | |
PRIMARY KEY (seq_num), | |
UNIQUE KEY (captain, flight), | |
UNIQUE KEY (name, seq_num) | |
); |
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 wikipedia, sys | |
def AStar(start, goal): | |
closedset = [] | |
openset = [trypage(link) for link in start.links] | |
navigated = {} | |
g_score = lambda start: 0 | |
f_score = lambda start: g_score(start) + heuristic_cost(start, goal) |
NewerOlder