diff --git a/README.md b/README.md index bc8b059..4173977 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ Include contains single header implementation of data structures and some algori ### Cracking the coding interview problems | Problem | Solution | | :------------ | :----------: | -| Problem 1-1 : Edition 6: Write an algorithm to determine whether a string has unique characters or not. Can we do it without using addtional data structures? | [1-1-hasUniqueChars.cpp](cracking_the_coding_interview_problems/1-1-hasUniqueChars.cpp)| +| Problem 1-1 : Edition 6: Write an algorithm to determine whether a string has unique characters or not. Can we do it without using additional data structures? | [1-1-hasUniqueChars.cpp](cracking_the_coding_interview_problems/1-1-hasUniqueChars.cpp)| | Problem 1-2 : Edition 5: Reverse a string when you are a pass a null terminated C string.|[1-2-edi5-reverseString.cpp ](cracking_the_coding_interview_problems/1-2-edi5-reverseString.cpp)| | Problem 1-2 : Edition 6: Given two strings, determine if one is permutation of other.|[1-2-perm-strings.cpp](cracking_the_coding_interview_problems/1-2-perm-strings.cpp)| | Problem 1-3 : Edition 5: Write an algorithm to remove duplicate chars from a string.|[1-3-edi5-removeDuplicates.cpp](cracking_the_coding_interview_problems/1-3-edi5-removeDuplicates.cpp)| diff --git a/bit_manipulation/right_most_set_bit.cpp b/bit_manipulation/right_most_set_bit.cpp index 4e725c2..b276bae 100644 --- a/bit_manipulation/right_most_set_bit.cpp +++ b/bit_manipulation/right_most_set_bit.cpp @@ -1,7 +1,7 @@ /** * Problem : One line function to return the position of right most bit. * Approach : take 2's compliment and it with number. - * And finally taking a log of 2 + 1 will give us the positon + * And finally taking a log of 2 + 1 will give us the position */ #include diff --git a/cracking_the_coding_interview_problems/1-1-hasUniqueChars.cpp b/cracking_the_coding_interview_problems/1-1-hasUniqueChars.cpp index ee2a30a..c360681 100644 --- a/cracking_the_coding_interview_problems/1-1-hasUniqueChars.cpp +++ b/cracking_the_coding_interview_problems/1-1-hasUniqueChars.cpp @@ -2,7 +2,7 @@ * Cracking the coding interview, edition 6 * Problem 1.1 * Write an algorithm to determine whether a string has unique characters or not - * Can we do it without using addtional data structures? + * Can we do it without using additional data structures? */ diff --git a/cracking_the_coding_interview_problems/1-3-URLify.cpp b/cracking_the_coding_interview_problems/1-3-URLify.cpp index 98f67b8..26594de 100644 --- a/cracking_the_coding_interview_problems/1-3-URLify.cpp +++ b/cracking_the_coding_interview_problems/1-3-URLify.cpp @@ -1,7 +1,7 @@ /* * Cracking the coding interview Edition 6 * Problem 1.3 URLify --> Replace all the spaces in a string with '%20'. - * Assumption : We have enough space to accomodate addition chars + * Assumption : We have enough space to accommodate addition chars * Preferebly in place */ @@ -10,7 +10,7 @@ /* * Function : urlify - * Args : string long enough to accomodate extra chars + true len + * Args : string long enough to accommodate extra chars + true len * Return : void (in place transformation of string) */ diff --git a/cracking_the_coding_interview_problems/2-2-kthToLast.cpp b/cracking_the_coding_interview_problems/2-2-kthToLast.cpp index de583df..5522fe8 100644 --- a/cracking_the_coding_interview_problems/2-2-kthToLast.cpp +++ b/cracking_the_coding_interview_problems/2-2-kthToLast.cpp @@ -9,7 +9,7 @@ * 1. Iterative: * Use two pointers * Move first pointer k places. - * Now move second pointer(from start) and first pointer (from k+1) simultanously. + * Now move second pointer(from start) and first pointer (from k+1) simultaneously. * When second pointer would have reached end, first pointer would be at kth node. * * 2. Recursive: diff --git a/leet_code_problems/shortest_path_maze.cpp b/leet_code_problems/shortest_path_maze.cpp index c94ae26..a4be3c7 100644 --- a/leet_code_problems/shortest_path_maze.cpp +++ b/leet_code_problems/shortest_path_maze.cpp @@ -54,7 +54,7 @@ int shortestPath(const std::vector>& matrix, const Point& source, const Point& destination) { - // An auxillary matrix to keep track of visited points + // An auxiliary matrix to keep track of visited points // initially all cells are marked unvisited. // std::vector> visited( diff --git a/string_problems/robinKarpStringMatching.cpp b/string_problems/robinKarpStringMatching.cpp index ae79573..959b498 100644 --- a/string_problems/robinKarpStringMatching.cpp +++ b/string_problems/robinKarpStringMatching.cpp @@ -1,5 +1,5 @@ /* - * Given a string pattern(P) and large Text string (T), Write a function search( P , T) which provide all the occurances of P in T. + * Given a string pattern(P) and large Text string (T), Write a function search( P , T) which provide all the occurrences of P in T. * example : T => "AABAACAADAABAAABAA". * P => "AABA" * Output : 0, 9, 13 ( all indices of T where pattern string P is starts to match. @@ -10,7 +10,7 @@ * Lets have a hash function --> hash. * Step 1 :We will calculate hash of Pattern P, lets say it is p * Step 2 : Then we will calculate hash of text portion from T[0-->M-1]. lets say t(0) - * Step 3: if ( p == t(0) ) if they match, add it to list of occurances. + * Step 3: if ( p == t(0) ) if they match, add it to list of occurrences. * Step 4: Go back to step 2, and calculate t(1) i.e hash of T[1-->M] using t(0) in O(1). * * The question remains, how do we calculate t(1) from t(0) in O(1), we do it using Horner's rule