diff --git a/include/binary_search_tree.h b/include/binary_search_tree.h index 5066c771..2fc544c0 100644 --- a/include/binary_search_tree.h +++ b/include/binary_search_tree.h @@ -31,7 +31,7 @@ namespace alg { class BST { private: /** - * binary search tree definiton. + * binary search tree definition. */ struct treeNode { KeyT key; // key diff --git a/include/dijkstra.h b/include/dijkstra.h index d0bebe7d..5013f14f 100644 --- a/include/dijkstra.h +++ b/include/dijkstra.h @@ -52,7 +52,7 @@ namespace alg { // all vertices Graph::Adjacent * a; list_for_each_entry(a, &g.list(), a_node){ - dist[a->v.id] = LARGE_NUMBER; // set inital distance to each vertex to a large number + dist[a->v.id] = LARGE_NUMBER; // set initial distance to each vertex to a large number (*previous)[a->v.id] = UNDEFINED; // clear path to UNDEFINED visited[a->v.id] = false; // all vertices are not visited Q.push(LARGE_NUMBER, a->v.id); // push all vertices to heap diff --git a/include/hash_table.h b/include/hash_table.h index 0fcdb713..1c5abd6e 100644 --- a/include/hash_table.h +++ b/include/hash_table.h @@ -36,7 +36,7 @@ namespace alg { typedef _HashCode hash_code_fn; private: /** - * definiton of Key-Value pair. + * definition of Key-Value pair. */ struct HashKV { key_type key; // 32-bit key diff --git a/include/merge_sort.h b/include/merge_sort.h index 8a45aece..5eab291d 100644 --- a/include/merge_sort.h +++ b/include/merge_sort.h @@ -13,8 +13,8 @@ * and right part. * Example: Say the input is -10 32 45 -78 91 1 0 -16 then the left part will be * -10 32 45 -78 and the right part will be 91 1 0 6. - * (2) Sort Each of them seperately. Note that here sort does not mean to sort it using some other - * method. We already wrote fucntion to sort it. Use the same. + * (2) Sort Each of them separately. Note that here sort does not mean to sort it using some other + * method. We already wrote function to sort it. Use the same. * (3) Then merge the two sorted parts. * * ------------ diff --git a/include/priority_queue.h b/include/priority_queue.h index 4a8dbe28..e81edf35 100644 --- a/include/priority_queue.h +++ b/include/priority_queue.h @@ -75,7 +75,7 @@ namespace alg { list_add(&n->node, &m_head); m_count++; } else { - // sequentially find the apropriate position + // sequentially find the appropriate position PQNode * pos; bool found = false; list_for_each_entry(pos, &m_head, node) { diff --git a/include/skiplist.h b/include/skiplist.h index 1c330ba7..f45d4f33 100644 --- a/include/skiplist.h +++ b/include/skiplist.h @@ -97,7 +97,7 @@ namespace alg { if(x == NULL || x->key != key) { int lvl = random_level(); // random promotion - // for nodes higer than current max level + // for nodes higher than current max level // make 'header node' as it's prev if(lvl > m_level) { for(int i = m_level + 1; i <= lvl; i++) { diff --git a/include/suffix_tree.h b/include/suffix_tree.h index 23bd04d6..d738d9c3 100644 --- a/include/suffix_tree.h +++ b/include/suffix_tree.h @@ -24,7 +24,7 @@ class SuffixTree SuffixTree(string str):test_str(str), root(test_str), active_point(&root, 0, 0), remainder(0), pos(0), active_e(0), ls() {} int construct(void); - // return -1 if no such sub exist, return the beginning postion of this substring in thr original string if it exist + // return -1 if no such sub exist, return the beginning position of this substring in thr original string if it exist int search(string sub); // return the length of the longest prefix of sub which can be matched in suffix tree @@ -257,7 +257,7 @@ class SuffixTree int remainder; // how many characters inserted? unsigned int pos; - unsigned int active_e; // the beginnig position of suffixes need to be inserted + unsigned int active_e; // the beginning position of suffixes need to be inserted char get_ele(int i) { return test_str[i]; } // insert a char from pos to suffix tree int insert(); @@ -266,7 +266,7 @@ class SuffixTree int print_node(Node* node, int level); - Node* seperate_edge(Node * node, Edge* edge); + Node* separate_edge(Node * node, Edge* edge); // check if we can change active node bool check_active_node(void) diff --git a/include/universal_hash.h b/include/universal_hash.h index 29afcf7d..1b162857 100644 --- a/include/universal_hash.h +++ b/include/universal_hash.h @@ -63,7 +63,7 @@ namespace alg { } /** - * hash an arbitary length integer. + * hash an arbitrary length integer. * len, number of 32-bit integer, max len is 32 */ static uint32_t uhash_bigint(const struct UHash * params, uint32_t * key, uint32_t len) { diff --git a/src/suffix_tree_demo.cpp b/src/suffix_tree_demo.cpp index 8862e9b2..d4425c68 100644 --- a/src/suffix_tree_demo.cpp +++ b/src/suffix_tree_demo.cpp @@ -82,7 +82,7 @@ int SuffixTree::construct(void) ls.ins_link(node); break; } - Node *newnode = seperate_edge(node, a_edge); + Node *newnode = separate_edge(node, a_edge); Edge* newedge = new Edge(pos, numeric_limits::max(), test_str); newnode->add_edge(newedge); ls.ins_link(newnode); @@ -106,7 +106,7 @@ int SuffixTree::construct(void) SuffixTree::Node* SuffixTree::seperate_edge(Node * node, Edge* a_edge) { - cout << "seperate the old edge here: " << (*a_edge) << endl; + cout << "separate the old edge here: " << (*a_edge) << endl; int new_begin = a_edge->begin + get_active_length(); int new_end = a_edge->end; @@ -175,7 +175,7 @@ using namespace std; int main() { - cout << "Begining" << endl; + cout << "Beginning" << endl; SuffixTree st("mississippi"); cout << "Constructing..." << endl;