Skip to content

Commit ebf9e2f

Browse files
authored
Add files via upload
1 parent 749f82d commit ebf9e2f

File tree

8 files changed

+160
-2
lines changed

8 files changed

+160
-2
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Define Coder
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,21 @@
1-
# definecoder.github.io
2-
ONE PLACE TO RULE THEM ALL
1+
# Welcome to DefineCoder
2+
3+
## Click the following links to see my notes on that topic
4+
5+
- [Sandard Template Library ~ STL](https://definecoder.github.io/STL/home)
6+
- Graph Theory
7+
- BFS
8+
- DFS
9+
- Dijkstra
10+
- Dynamic Programming
11+
- BitSet
12+
- Greedy
13+
- Two Pointer
14+
- Geometry
15+
- Combinatorics
16+
17+
## This page is managed by :
18+
- [Md. Mehrajul Islam](https://codermehraj.github.io)
19+
- [Ariful Islam Shanto](https://shanto-swe029.github.io)
20+
- [Shawon Majid](https://shawon-majid.github.io)
21+
- [Samiul Islam Mugdha](https://mugdha-samiul.github.io)

STL/home.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Standard Template Library in C++
2+
3+
STL is a very powefull tool for **competitive programming**. It saves a lot of time and makes your code easier to read.
4+
<br>
5+
## I will talk about these in this note :
6+
`Click in the links to see the notes on that topic`
7+
- [String](https://definecoder.github.io/STL/string)
8+
- [Pair](https://definecoder.github.io/STL/pair)
9+
- [Vector](https://definecoder.github.io/STL/vector)
10+
- [Stack](https://definecoder.github.io/STL/stack)
11+
- Queue
12+
* Deque
13+
- Priority Queue
14+
- Set
15+
* Multiset
16+
* Unordered Set
17+
* Unordered Multiset
18+
- Map
19+
* Multimap
20+
* Unordered Map
21+
* Unordered Multimap
22+
- List
23+
<br>
24+
Also some useful features like `next_permutaion() , stringstream` etc in this **link**

STL/pair.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Let's Make some Pairs!

STL/stack.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# stack
2+
tutorial about stack

STL/string.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
2+
# String
3+
4+
To use string first of all you have to add this header **` #include <string> `**
5+
6+
## Declaring and Initializing a String
7+
It is very easy to declare a string. You can create a string variable nammed as MyString by typing **` string MyString ; `**
8+
9+
You can declare several string togather in a line. You can also _**initialize**_ a string using **` string MyString = "Hello World!" `**.
10+
You can also do that later in your code.
11+
12+
You can take a string from the user using **` cin >> MySting ; `** which only takes the string _**up to a space**_
13+
14+
If you want to get _**a full line including spaces**_ use this instead **` getline( cin , MyString ) ; `**
15+
16+
## Basic Sting Operations
17+
18+
Lets say you have two strings **` string a = "Hello " , b = "World" ; `** You can add string **b** after string **a** using **` a = a + b `**
19+
after this opatertion the value of a will be **"Hello World"**.
20+
That is how you can **concatenate** two strings.
21+
22+
You can delete last charecter on a sting using **` MyString.pop_back() `**
23+
24+
As you know string is an array of charecters so you can access any index (0 to length-1) and change that in constant time. _e.g:_ **` MyString[0] = 'h' ; `**
25+
26+
You can print a string using **` cout << MyString << endl ; `**
27+
28+
You can check the equality of two strings using **` strA == strB `** and inequality using **` strA != strB `** .
29+
You can also check which string is lexicographically greater using **` strA > strB `** vice versa.
30+
31+
## String Functions :
32+
33+
| Function | Work of the function |
34+
|:-----------------------:|:------------------------------------------------------------------------------:|
35+
| MyString.size() | Returns The size of the string |
36+
| str1.swap(str2) | Swaps the value of str1 and str2 |
37+
| MyString.insert(x,s) | Inserts s in the xth index of MyString |
38+
| MySrting.find(s) | returns initial index of first occurrence of the s in MyString else returns -1 |
39+
| MySrting.rfind(s) | returns initial index of last occurrence of the s in MyString else returns -1 |
40+
| MyString.replace(i,j,s) | Replaces j characters from ith index of MyString with new string s |
41+
| stoi(MyString) | Returns the integer converted form of MyString |
42+
| MyString.substr(i,k) | Returns a substing of length k from ith index of MyString |
43+
| MyString.erase(i) | Erases every element from ith index to the end of MyString |
44+
| MyString.clear() | Erases every element in MyStirng |
45+
| MyString.empty() | Returns True if MyString is empty else return false |

STL/vector.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Vector
2+
## Introduction
3+
Vector is one of the most powerful Data Type in ***C++ programming language*** and very much helpful for competitive programmers. The concept of vector is almost same as C programming language’s ***Array***. However, in C++, we call the vector ***“A Container”***. A container can contain everything such as *<ins>`integers, doubles, characters, bools, strings, structures`</inS>* and a vector can contain *<ins>`some vectors`</ins>* too. But the most important feature of vector is –***“Its memory is allocated dynamically.”*** We can change its length at any time and you can perform many operations that is not possible for C language’s array. We will see and learn all of these things gradually in a proper way.
4+
<br/>
5+
<br/>
6+
## Header File
7+
We have to include an extra header file to use this data type. That is- <br/>
8+
`#include <vector>`<br/>
9+
Under this header file, we can access all the library functions that can be used for vector data type.
10+
<br/>
11+
<br/>
12+
## Declaration and initialization of a vector
13+
We can declare a vector in several ways. Let us see them one by one and understand their differences gradually.
14+
- `vector < Datatype > MyVector;`<br/>
15+
Using this format, we can declare a vector. Now we can see that the size of the vector is not mentioned here. That means **“we have not allocated any memory for this vector.”** In this case if we want to add any value (of the datatype mentioned inside), we have to use a library function `push_back()`. For example, if we want to store 55, 72, 89 and 100 into an integer vector, we have to perform these:
16+
```
17+
vector < int > v;
18+
v.push_back(55);
19+
v.push_back(72);
20+
v.push_back(89);
21+
v.push_back(100);
22+
```
23+
Alternatively, we can write them also in a single line using commas, like this-
24+
```
25+
vector < int > v;
26+
v.push_back(55), v.push_back(72), v.push_back(89), v.push_back(100);
27+
```
28+
The size of vector `v` will be as much element we insert into the vector using `push_back()` function.
29+
- `vector < Datatype > MyVector(n);` where n = size of the vector.<br/>
30+
Thus we can initially allocate the memory needed for our vector like this. Using this method will give us two extra benefit:
31+
- This will set the values of all index to 0 automatically.
32+
- We can now access any index form 0 to size-1 inclusively by <br/>`“MyVector[i]”`; where i = index.<br/>
33+
But still we can change the size of the vector at any time. Besides, we can also store more than n elements into the vector (if needed). Using `push_back()`, we can add elements from index n to maximum size.
34+
35+
Suppose, we are declaring a vector of length 3 and store 3 values into the vector. we have to do it like-
36+
```
37+
vector < int > v(3);
38+
v[0] = 29, v[1] = 37, v[2] = 23;
39+
```
40+
41+
Now if we want to add more elements, we can do it by simply using `push_back()`. <br/>
42+
```
43+
v.push_back(18), v.push_back(97);
44+
```
45+
**Now the size of the vector is increased from three to five**.

_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
theme: jekyll-theme-cayman

0 commit comments

Comments
 (0)