Skip to content

Commit cc9e428

Browse files
committed
Fix documentation typos
1 parent 55017ef commit cc9e428

File tree

49 files changed

+74
-74
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+74
-74
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ List of Programs related to data structures and algorithms
9797

9898
| No. | Name | Source | Playground | Documentation | Level | Pattern |
9999
| :-: | :------------------ | :-------------------------------------------------------------------------------------------------------------------------------------------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------: | :----: | :-----------------: |
100-
| 1 | Sum of two integers | [Source](https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/binary/1.twoSum/twoSum.js) | [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/binary/1.twoSum/twoSum.js) | [Documentation](https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/binary/1.twoSum/twoSum.md) | Medium | Bitwise opeations |
100+
| 1 | Sum of two integers | [Source](https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/binary/1.twoSum/twoSum.js) | [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/binary/1.twoSum/twoSum.js) | [Documentation](https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/binary/1.twoSum/twoSum.md) | Medium | Bitwise operations |
101101
| 2 | Number of 1 Bits | [Source](https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/binary/2.numberOf1Bits/numberOf1Bits.js) | [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/binary/2.numberOf1Bits/numberOf1Bits.js) | [Documentation](https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/binary/2.numberOf1Bits/numberOf1Bits.md) | Easy | Brian Kernighans |
102102
| 3 | Counting Bits | [Source](https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/binary/3.countingBits/countingBits.js) | [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/binary/3.countingBits/countingBits.js) | [Documentation](https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/binary/3.countingBits/countingBits.md) | Easy | Dynamic programming |
103103
| 4 | Missing number | [Source](https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/binary/4.missingNumber/missingNumber.js) | [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/binary/4.missingNumber/missingNumber.js) | [Documentation](https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/binary/4.missingNumber/missingNumber.js) | Easy | Bitwise XOR |
@@ -188,7 +188,7 @@ List of Programs related to data structures and algorithms
188188

189189
4. Number of Islands: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/graph/numberOfIslands.js)
190190

191-
5. Longest consequtive sequence: [JavaScript](https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/graph/longestConsecutiveSequence.js)
191+
5. Longest consecutive sequence: [JavaScript](https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/graph/longestConsecutiveSequence.js)
192192

193193
6. Alien dictionary: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/graph/alienDictionary.js)
194194

src/java1/algorithms/array/containerWithMostWater/ContainerWithMostWater.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ This problem is solved with the help of two pointer technique on opposite ends.
3131

3232
8. Repeat steps 4-7 until all the elements traversed.
3333

34-
9. Return the maximum capcity of the container.
34+
9. Return the maximum capacity of the container.
3535

3636
**Time and Space complexity:**
3737
This algorithm has a time complexity of `O(n)`, where `n` is the number of elements. This is because the left or right pointer moved towards the other until they meet in each iteration, the elements are traversed once.

src/java1/algorithms/array/maxSumCircularSubarray/MaxSumCircularSubarray.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ This problem is solved with the help of Kadane's algorithm(dynamic programming t
2929

3030
5. Iterate over an input array to calculate the maximum value.
3131

32-
6. Calculate the maximum and minimum sum at each element positon. The minimum sum is required to derive maximum value incase of cirucular subarray contains maximum value.
32+
6. Calculate the maximum and minimum sum at each element positon. The minimum sum is required to derive maximum value incase of circular subarray contains maximum value.
3333

3434
7. Find the total sum of all the numbers and store it in
3535

src/java1/algorithms/array/minimumRotatedSortedarray/minimumRotatedSortedarray.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ This problem is solved with the help of binary search technique. Since it is a r
3838

3939
**Time and Space complexity:**
4040

41-
This algorithm has a time complexity of `O(log n)`, where `n` is the number of elements. This is because we divide the array into two subarray each time and find the minimum element in the correct subarray using binary search alogorithm.
41+
This algorithm has a time complexity of `O(log n)`, where `n` is the number of elements. This is because we divide the array into two subarray each time and find the minimum element in the correct subarray using binary search algorithm.
4242

4343
Here, we don't use any additional datastructure other than the result variable. Hence, the space complexity will be O(1).

src/java1/algorithms/array/minimumSizeSubarraySum/MinimumSizeSubarraySum.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ This problem is solved with the help of sliding window approach without using an
2525

2626
5. Calculate the total value by adding array value at respective right pointer.
2727

28-
6. If the total value is greather or equal to target, find the minimum of subarray sum and shrink the current window total and left pointer value. This step need to be repeated until there are no subarray exists to meet the target criteria.
28+
6. If the total value is greater or equal to target, find the minimum of subarray sum and shrink the current window total and left pointer value. This step need to be repeated until there are no subarray exists to meet the target criteria.
2929

3030
7. Increment the right pointer to find the next subarray.
3131

src/java1/algorithms/array/rotateArray/RotateArray.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ This problem is solved with the help of two pointers, which is used to reverse s
2121

2222
3. Create a helper function to reverse elements of an array using swap operation with the help left and right pointers(i.e, `left` and `right`). The left pointer needs to be incremented and right pointer needs to decremented for each iteration.
2323

24-
4. Invoke reversal operation for entire array of elements(i.e, from the beggining to end of an array).
24+
4. Invoke reversal operation for entire array of elements(i.e, from the beginning to end of an array).
2525

26-
5. Invoke reversal operation for first `n` number of elements(i.e, from the beggining to n-1).
26+
5. Invoke reversal operation for first `n` number of elements(i.e, from the beginning to n-1).
2727

2828
6. Invoke reversal operation for remaining number of elements(i.e, from `n-1` to end of an array).
2929

src/java1/algorithms/array/searchRotatedSortedArray/SearchRotatedSortedArray.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ This problem is solved with the help of binary search technique. Since it is a r
3535

3636
**Time and Space complexity:**
3737

38-
This algorithm has a time complexity of `O(log n)`, where `n` is the number of elements. This is because we divide the array into two subarrays each time and find the index of target element using binary search alogorithm.
38+
This algorithm has a time complexity of `O(log n)`, where `n` is the number of elements. This is because we divide the array into two subarrays each time and find the index of target element using binary search algorithm.
3939

4040
Here, we don't use any additional datastructure other than two left pointer variables. Hence, the space complexity will be O(1).

src/java1/algorithms/array/sortColors/SortColors.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ This problem is solved with the help of **two pointers** technique. It is also k
3030

3131
5. If the current character is equals to 2, swap the character values at right pointer and index pointer. Also, decrement the right pointer.
3232

33-
6. If the chracter is neither `0` or `2`, then just increment the index pointer.
33+
6. If the character is neither `0` or `2`, then just increment the index pointer.
3434

3535
7. Repeat steps 4–6 until the index pointer reaches the end of the array.
3636

37-
8. Return the updated in-place array where chracters are sorted.
37+
8. Return the updated in-place array where characters are sorted.
3838

3939
**Time and Space complexity:**
4040
This algorithm takes a time complexity of `O(n)` because we are traversing the array only once. Also, it requires space complexity of `O(1)` because we are updating the array in-place without using an additional data structure.

src/java1/algorithms/binary/countingBits/CountingBits.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ This problem is solved with the help of **dynamic programming** technique where
1717

1818
2. Initialize the `ans` array with a length of `num+1` where each element assigned to zero by default. This array indicates the number of `1`s in each element from `0` to `num`.
1919

20-
3. Initialize the offset(`offset`) variable to 1. This is because the first offset with power of 2 is 1(i.e, 2 power 0). In this problem, you can find pattern that offset is multiplyed by 2 when the index value is power of 2.
20+
3. Initialize the offset(`offset`) variable to 1. This is because the first offset with power of 2 is 1(i.e, 2 power 0). In this problem, you can find pattern that offset is multiplied by 2 when the index value is power of 2.
2121

2222
4. Iterate over each element upto `num` to find the counting bits.
2323

24-
5. The offset should be updated to the index variable(`i`) once the offset multipled by 2 is equal to index variable.
24+
5. The offset should be updated to the index variable(`i`) once the offset multiplied by 2 is equal to index variable.
2525

26-
6. If the condition in step5 fails, the number of 1's for current number is caluclated by adding the number of 1's in previous power of 2 index variable with 1.
26+
6. If the condition in step5 fails, the number of 1's for current number is calculated by adding the number of 1's in previous power of 2 index variable with 1.
2727

28-
7. Repeat 5-6 steps to caculate the number of set bits for each element.
28+
7. Repeat 5-6 steps to calculate the number of set bits for each element.
2929

3030
8. Return the `ans` array which holds number of set bits upto input number.
3131

src/java1/algorithms/binary/numberOf1Bits/NumberOf1Bits.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This problem is solved with the help of **Brian Kernighans** technique. The main
2121

2222
3. Iterate the number until it became zero.
2323

24-
4. Update the number by multiplying the number itself with number which is substracted by 1. It helps to invert the right most bit everytime.
24+
4. Update the number by multiplying the number itself with number which is subtracted by 1. It helps to invert the right most bit everytime.
2525

2626
5. Update the counter by one for each iteration.
2727

src/java1/algorithms/binary/reverseBits/ReverseBits.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Input: num = 8
1111
Output: 268435456
1212

1313
**Algorithmic Steps:**
14-
This problem is solved with the help of **Bitwise operations**. The main intution of this algorithm is to retrieve each bit individually from least significant bit to the most significant bit and place that bit in the reversed position of a new number. As a result, the least signicant bits moved to most significant bit side and vice-versa. The algorithmic approach can be summarized as follows:
14+
This problem is solved with the help of **Bitwise operations**. The main intution of this algorithm is to retrieve each bit individually from least significant bit to the most significant bit and place that bit in the reversed position of a new number. As a result, the least significant bits moved to most significant bit side and vice-versa. The algorithmic approach can be summarized as follows:
1515

1616
1. Get the number `num` as input parameter.
1717

src/java1/algorithms/binary/twoSum/TwoSum.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This problem is solved with the help of **bitwise operators** technique. The add
1515

1616
1. Get the two numbers `a` and `b` as input parameters.
1717

18-
2. Iterate the bitwise opeations until `b` is not zero.
18+
2. Iterate the bitwise operations until `b` is not zero.
1919

2020
3. Calculate the carry of the two numbers using Bitwise AND operation. Also, shift the carry to the left 1. The can be store in a `temp` variable.
2121

src/java1/algorithms/graph/AlienDictionary.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
public class AlienDictionary {
66

7-
//BFS(Topological sorting through Kahn's alogirthm):- TC: O(m*n) SC:O(m*n)
7+
//BFS(Topological sorting through Kahn's algorithm):- TC: O(m*n) SC:O(m*n)
88
private static String alienOrder(String[] words) {
99
if(words == null || words.length == 0) return null;
1010

src/java1/algorithms/hashmap/twoSum/TwoSum.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This problem is solved in a one pass with the help of HashMap data structure. Th
88

99
4. Iterate over the input array using index pointer until the end of the array.
1010

11-
5. Find the complement by substracting the target and current number. If the complement already exists in the map, return the indices of complement and current number as output.
11+
5. Find the complement by subtracting the target and current number. If the complement already exists in the map, return the indices of complement and current number as output.
1212

1313
6. If the complement doesn't exist in our indexMap, just add the current number and its index to the map.
1414

src/java1/algorithms/interval/meetingRooms/meetingRooms.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ This problem is solved with the help of greedy approach. The algorithmic approac
2323

2424
**Note:** Remember that the main idea behind this solution is to verify that each meeting ends before the next meeting starts.
2525

26-
3. If the start time is less than the end time of the previous interval, then there is an overlap between the intervals. In this case, a person cannot attend all meetings. So you need to return `false` immeidately.
26+
3. If the start time is less than the end time of the previous interval, then there is an overlap between the intervals. In this case, a person cannot attend all meetings. So you need to return `false` immediately.
2727

2828
4. If the start time is greater than the previous interval's end time, then there is no overlap between the intervals. In this case, you need to proceed with next set of intervals to find any overlap between the meetings.
2929

src/java1/algorithms/interval/nonOverlappingIntervals/NonOverlappingIntervals.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ This problem is solved with the help of greedy approach. The algorithmic approac
33

44
1. First, sort the list of intervals based on their start times. This step helps to keep the overlapping intervals next to each other in the list.
55

6-
2. Initialize a minimum removal of intervals varaible `minRemove` to 0, which is used to hold the minimum number of intervals to be removed to make non-overlapping intervals.
6+
2. Initialize a minimum removal of intervals variable `minRemove` to 0, which is used to hold the minimum number of intervals to be removed to make non-overlapping intervals.
77

88
3. Initialize previous end value of an interval `prevEnd` with first interval end value. i.e, Here, first interval is considered as non-overlapping interval by default.
99

src/java1/algorithms/matrix/WordSearch.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ private static boolean dfs(char[][] board, String word, int r, int c, int curr)
2020
// If the entire word has been found in the board
2121
if(word.length() == curr) return true;
2222

23-
// Verfiy out of bounds or mismatched letter
23+
// Verify out of bounds or mismatched letter
2424
if(r < 0 || r >= board.length || c<0 || c >= board[0].length || board[r][c] != word.charAt(curr) || board[r][c] == '*') return false;
2525

2626
//Mark the current word as visited

src/java1/algorithms/stack/dailyTemperatures/DailyTemperatures.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ This problem is solved with the help of monotonic decreasing stack. The algorith
77

88
3. Iterate over the input array using an iteration variable `currDay`(from 0 to length of array).
99

10-
4. For each iteration, create nested iteration to shrink the stack until the stack is not empty and current temparature is greater than previous day temperation.
10+
4. For each iteration, create nested iteration to shrink the stack until the stack is not empty and current temperature is greater than previous day temperation.
1111

12-
5. As part of the nested iteration, the top element of stack needs to be poped-out and number of days(current day index - previous day index) to wait for warmer temparature stores in previous day's index.
12+
5. As part of the nested iteration, the top element of stack needs to be poped-out and number of days(current day index - previous day index) to wait for warmer temperature stores in previous day's index.
1313

1414
6. If the current day temperature is less than previous day, the respective current day index is stored in the stack.
1515

src/java1/algorithms/stack/numberOfPeopleSeeInQueue/NumberOfPeopleSeeInQueue.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ This problem is solved with the help of monotonic decreasing stack. The algorith
33

44
1. Initialize the length variable which indicates number of people in the queue.
55

6-
2. Initialize a `visiblityCount` array with the same length of input `heights` array, filled with zeros.
6+
2. Initialize a `visibilityCount` array with the same length of input `heights` array, filled with zeros.
77

88
3. Initialize a monotonic stack named `stack` which stores the heights of persons.
99

@@ -16,7 +16,7 @@ to the current person.
1616

1717
6. Add the current taller person height to the stack.
1818

19-
7. Return the visiblity count array which indicate number of persions of visible at each position.
19+
7. Return the visibility count array which indicate number of persions of visible at each position.
2020

2121
**Time and Space complexity:**
2222
This algorithm has a time complexity of O(n), where n is the number of people a person can see. This is because we are iterating the array only once. However, each element performs multiple comparisons along with pop operations from the stack until a higher height is found. In the worst, each element will be pushed and popped from the stack once, leads to time complexity of O(n). So the overall time complexity is O(n).

src/java1/algorithms/strings/encodeDecodeStrings/EncodeDecodeStrings.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ This problem is solved with the help of basic string and array built-in operatio
3131

3232
4. Create a temporary variable(`j`) which is assigned to index variable.
3333

34-
5. Skip the prefix related to each string's length until the character reaches special(`#`) symbol. The number of characters ignored are indicated by incremental value of `j`. The next character position(`j+1`) indicates the beggining of a string.
34+
5. Skip the prefix related to each string's length until the character reaches special(`#`) symbol. The number of characters ignored are indicated by incremental value of `j`. The next character position(`j+1`) indicates the beginning of a string.
3535

3636
6. Calculate the word length followed by substring using the index variables.
3737

0 commit comments

Comments
 (0)