Skip to content

Commit 1a45bee

Browse files
authored
Merge pull request #915 from timgates42/bugfix_typos
docs: Fix a few typos
2 parents 3a2cc2c + 2b5165f commit 1a45bee

File tree

10 files changed

+10
-10
lines changed

10 files changed

+10
-10
lines changed

Data Structures/Graphs/BFS.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def valid(li,n):
2323
matrix=[]
2424
for _ in range(n):
2525
li=list(map(int,input().split()))
26-
if(valid(li,n)==False): # check wheather the given list is in valid adjacency matrix or not should contain 0's and 1's
26+
if(valid(li,n)==False): # check whether the given list is in valid adjacency matrix or not should contain 0's and 1's
2727
print("Enter valid n*n matrix")
2828
exit # Terminate the program for incorrect details
2929
matrix.append(li)

Data Structures/Stacks/Previous_Greater_Element.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void printPrevGreater(int arr[],int n){
2929
previous greater element from
3030
the current value and simply print
3131
it and if not found print -1.
32-
NOTE : After every iteration whaterever the remaining element is
32+
NOTE : After every iteration whatever the remaining element is
3333
present at the top is Previous Greater and if stack is empty
3434
then previous Greater is -1.
3535
*/

Dynamic Programming/Buy_And_Sell_Stocks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* problem statement
22
first input is n representing the number of days
33
after that we have n values ,representing the price of stock on that day
4-
ouput should be maximum profit , if you can buy and sell only one time
4+
output should be maximum profit , if you can buy and sell only one time
55
*/
66

77
#include <iostream>

Dynamic Programming/Square_brackets.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ LL sq_brackets(LL n, LL k, VLL pos)
3131
{
3232
vector<bool>h(2*n+1, 0);
3333
LL i;
34-
rep(i, k) h[pos[i]]=1; // hash array ti store the postions where opening bracket is must
34+
rep(i, k) h[pos[i]]=1; // hash array ti store the positions where opening bracket is must
3535
// dp array
3636
vector<vector<LL>>dp(2*n+1, vector<LL>(2*n+1, 0));
3737
// first position only one possible combination

Dynamic Programming/knapsack_01.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
// in the main code. whenever you are going in any condition, make the matrix on basis of the dimension of the varibale
3535
// inputs of the recurisie function. Here it will be W and n, make a matrix of W+1 and n+1 dimension and for every recurvie
3636
// return, instead, store that value insdie that matrix, before going into any call, check if
37-
// the value foor that W and n is soomething else than the initalize mem set value of the matrix, if so directly return that
37+
// the value foor that W and n is something else than the initalize mem set value of the matrix, if so directly return that
3838

3939

4040

General Questions/intersection_of_arrays.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ input
1010
output
1111
10 57
1212
13-
We consider two pointers i,j for travsersing the array only once making the time complexity of the algoirithm
13+
We consider two pointers i,j for traversing the array only once making the time complexity of the algoirithm
1414
to O(m+n) rather than O(m*n) for a brute force approach where m and n are the array sizes.
1515
*/
1616
#include<stdio.h>

Numbers/Sieve-of-Eratosthenes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ void sieve(){
1313
ll i,j;
1414
Prime[0]=Prime[1]=false;
1515

16-
//adding this otpimization will reduce n/2 computations
16+
//adding this optimization will reduce n/2 computations
1717
//since even no.s are not prime
1818
for(i=2;i<N+1;i+=2)
1919
Prime[i]=false;

Sorting Algorithms/insertion_sort.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Given an array, the elements of the array needs to be arranged in an increasing
33
44
Algorithm:
55
1. Traverse the array and keep track of the element to be inserted at each stage.
6-
2. Store the element to be inserted in a varible.
6+
2. Store the element to be inserted in a variable.
77
3. Shift the elements accordingly to make the array sorted.
88
99
Input:

Strings/Capitalizing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# Complete the solve function below.
77
def solve(s):
8-
# spliiting the string into words
8+
# splitting the string into words
99
for x in s[:].split():
1010
# replacing the character with it's capital form
1111
s = s.replace(x, x.capitalize())

Trie/Trie_add_Search_using_dict.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def add(self, word): # This funtion adds new word to Trie
2525
cur[ch] = {}
2626
cur = cur[ch] # now go to the key that was created or was present
2727
cur['*'] = True # set * key to true at the end of each word
28-
#so larger the word the dictionary nesting will take place and * key represant the end state of the word
28+
#so larger the word the dictionary nesting will take place and * key represent the end state of the word
2929

3030
def search(self,word): # This function searches whether the word is presant or not presant
3131
cur = self.root #cur is iterator to check whether new key/paths are presant or not

0 commit comments

Comments
 (0)