Skip to content

Commit c250bf4

Browse files
committed
algorithms & ds - (c++ libraries)
1 parent 9c14149 commit c250bf4

File tree

8 files changed

+295
-9
lines changed

8 files changed

+295
-9
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# alg-rithmth 🌸
1+
# ΛlgΘ-rithm 🌸
22

33
my notes on mathematics, algorithms and programming:
44

RESOURCE.MD

+10-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<td>
88
<b>MIT</b> :
99

10-
[MIT CSAIL Research Groups](https://www.csail.mit.edu/research/?category=Groups) / [SparkLab](https://web.mit.edu/sparklab/)
10+
[CSAIL Research Groups](https://www.csail.mit.edu/research/?category=Groups) / [SparkLab](https://web.mit.edu/sparklab/)
1111
</td>
1212
<td>
1313
<b>CMU</b>:
@@ -74,14 +74,16 @@ TU Munich / [Smart Robotics Lab](https://srl.cit.tum.de/)</b>
7474
</td><td>
7575
<b>NYU</b>
7676
</td><td>
77-
<b>Columbia</b>
77+
<b>Osaka University</b>
7878
</td>
7979
</tr>
8080

8181

8282
<tr>
8383
<td>
84-
<b>University of Alberta</b>
84+
<b>
85+
86+
University of Leeds / [Institute of Robotics, Autonomous Systems and Sensing](https://eps.leeds.ac.uk/electronic-engineering-robotics)</b>
8587
</td>
8688
<td>
8789
<b>University of Torronto</b>
@@ -172,6 +174,8 @@ Some of the companies involved in cutting edge Robotics and Machine Learning res
172174

173175
</table>
174176

177+
Some of the YC - [[robotics startups](https://www.ycombinator.com/companies/industry/robotics), [AI startups](https://www.ycombinator.com/companies/industry/ai)], EU AI startups : [ai-startups-europe.eu](https://www.ai-startups-europe.eu/), [generative-ai-starups](https://app.dealroom.co/lists/33530).
178+
175179
## Autonomous Systems Lab:
176180

177181
<table style="width:100%" >
@@ -184,11 +188,11 @@ Some of the companies involved in cutting edge Robotics and Machine Learning res
184188
<td>
185189
<b>MIT</b>:
186190

187-
[Spark Lab](https://web.mit.edu/sparklab/)
191+
[Spark Lab](https://web.mit.edu/sparklab/), [ARCLab](https://aeroastro.mit.edu/arclab/)
188192
</td><td>
189193
<b>Stanford</b>
190194

191-
[ASL](https://aa.stanford.edu/research-impact/labs-and-centers/autonomous-systems-lab)
195+
[ASL](https://aa.stanford.edu/research-impact/labs-and-centers/autonomous-systems-lab), [CAESAR](https://caesar.stanford.edu/)
192196
</td><td>
193197
<b>Norwegian University of Science and Technology (NTNU)</b>
194198

@@ -253,7 +257,7 @@ Some of the companies involved in cutting edge Robotics and Machine Learning res
253257

254258

255259

256-
Multiagent-systems [[ labs ](https://multirobotsystems.org/labs)], AI startups : [ai-startups-europe.eu](https://www.ai-startups-europe.eu/), [generative-ai-starups](https://app.dealroom.co/lists/33530), [FDL](https://frontierdevelopmentlab.org/) and AI [residency programs](https://github.com/dangkhoasdc/awesome-ai-residency#internships).
260+
Multiagent-systems [[ labs ](https://multirobotsystems.org/labs)], [FDL](https://frontierdevelopmentlab.org/) and AI [residency programs](https://github.com/dangkhoasdc/awesome-ai-residency#internships).
257261
## Behavioral Section :
258262

259263
🌸 Some of my notes from AlgoExpert's behavioural section classes.

competitive_prog/README.MD

+284-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,293 @@ A short introduction to C++ for AI and Robotics:
1616
🌸
1717
```
1818

19-
### NOTES : [ [Functions](fn.MD) , [Standard Template Library (STL)](./stl.MD), [Utilities & Libraries](./util.MD), [OpenCV](./opencv.MD), [Math Libraries](./mathcpp.MD) ]
19+
### NOTES : [ [Functions](./doc/fn.MD) , [Standard Template Library (STL)](./doc/stl.MD), [Utilities & Libraries](./doc/util.MD), [OpenCV](./doc/opencv.MD), [Math Libraries](./doc/mathcpp.MD) ]
2020

2121
I am comfortable with c++ build systems and c++ was my first programming language that I used extensively throughout high school. I have an overview note on problem solving with c++:
2222

23-
[ [c++ iterators](https://www.javatpoint.com/cpp-iterators), [c++ enumeration](https://www.javatpoint.com/cpp-enumeration), [c++ bitset](https://www.javatpoint.com/post/cpp-bitset), [c++ map](https://www.javatpoint.com/post/cpp-map), [c++ multimap](https://www.javatpoint.com/post/cpp-multimap), [c++ templates](https://www.javatpoint.com/cpp-templates), [c++ files and streams](https://www.javatpoint.com/cpp-files-and-streams), [c++ algorithms](https://www.javatpoint.com/cpp-algorithm), [c++ namespaces](https://www.javatpoint.com/cpp-namespaces), [c++ math functions](https://www.javatpoint.com/cpp-math-functions) ]
23+
24+
<table width=100%>
25+
<tr>
26+
<th>C++ Iterators:</th>
27+
<th>C++ Enumeration:</th>
28+
</tr>
29+
30+
<tr>
31+
<td>
32+
33+
Iterators are objects that point to elements within a container. They provide a way to traverse through the elements of a container (like arrays, vectors, lists, etc.). Iterators can be incremented (to move to the next element) or decremented (to move to the previous element).
34+
35+
```cpp
36+
#include <iostream>
37+
#include <vector>
38+
39+
int main() {
40+
std::vector<int> vec = {1, 2, 3, 4, 5};
41+
42+
// Using an iterator to traverse the vector
43+
std::vector<int>::iterator it;
44+
for (it = vec.begin(); it != vec.end(); ++it) {
45+
std::cout << *it << " ";
46+
}
47+
std::cout << std::endl;
48+
49+
return 0;
50+
}
51+
```
52+
</td>
53+
54+
<td>
55+
56+
Enumeration (enum) is a user-defined data type in C++ that consists of integral constants. Each enum variable is assigned an integer value by default.
57+
58+
```cpp
59+
#include <iostream>
60+
61+
enum Color { RED, GREEN, BLUE };
62+
63+
int main() {
64+
Color c = RED;
65+
66+
if (c == RED) {
67+
std::cout << "The color is red." << std::endl;
68+
}
69+
70+
return 0;
71+
}
72+
```
73+
</td>
74+
</tr>
75+
76+
<tr>
77+
<th>C++ Bitset:</th>
78+
<th>C++ Map:</th>
79+
</tr>
80+
81+
<tr>
82+
<td>
83+
84+
The bitset class in C++ is used to store a fixed-size sequence of bits. Each bit can be accessed individually, and bitwise operations can be performed.
85+
86+
```cpp
87+
#include <iostream>
88+
#include <bitset>
89+
90+
int main() {
91+
std::bitset<8> bs1(std::string("1100"));
92+
std::bitset<8> bs2(std::string("1010"));
93+
94+
// Bitwise AND
95+
std::bitset<8> bs_and = bs1 & bs2;
96+
std::cout << "AND: " << bs_and << std::endl;
97+
98+
// Bitwise OR
99+
std::bitset<8> bs_or = bs1 | bs2;
100+
std::cout << "OR: " << bs_or << std::endl;
101+
102+
// Bitwise XOR
103+
std::bitset<8> bs_xor = bs1 ^ bs2;
104+
std::cout << "XOR: " << bs_xor << std::endl;
105+
106+
return 0;
107+
}
108+
```
109+
</td>
110+
111+
<td>
112+
A map is an associative container that stores key-value pairs. Each key is unique, and the values can be accessed using the keys.
113+
114+
```cpp
115+
#include <iostream>
116+
#include <map>
117+
118+
int main() {
119+
std::map<int, std::string> myMap;
120+
121+
// Inserting elements into the map
122+
myMap[1] = "One";
123+
myMap[2] = "Two";
124+
myMap[3] = "Three";
125+
126+
// Accessing elements
127+
std::cout << "Key 1: " << myMap[1] << std::endl;
128+
129+
// Iterating through the map
130+
for (auto it = myMap.begin(); it != myMap.end(); ++it) {
131+
std::cout << it->first << ": " << it->second << std::endl;
132+
}
133+
134+
return 0;
135+
}
136+
```
137+
</td>
138+
</tr>
139+
140+
<tr>
141+
<th>C++ Multimap:</th>
142+
<th>C++ Templates:</th>
143+
</tr>
144+
145+
<tr>
146+
<td>
147+
A multimap is similar to a map, but it allows multiple elements to have the same key.
148+
149+
```cpp
150+
#include <iostream>
151+
#include <map>
152+
153+
int main() {
154+
std::multimap<int, std::string> myMultimap;
155+
156+
// Inserting elements into the multimap
157+
myMultimap.insert({1, "One"});
158+
myMultimap.insert({1, "Uno"});
159+
myMultimap.insert({2, "Two"});
160+
161+
// Accessing elements
162+
auto range = myMultimap.equal_range(1);
163+
for (auto it = range.first; it != range.second; ++it) {
164+
std::cout << it->first << ": " << it->second << std::endl;
165+
}
166+
167+
return 0;
168+
}
169+
```
170+
</td>
171+
172+
<td>
173+
174+
Templates allow writing generic programs that can work with any data type. They are particularly useful for creating functions and classes that operate on different data types.
175+
176+
```cpp
177+
#include <iostream>
178+
179+
template <typename T>
180+
T add(T a, T b) {
181+
return a + b;
182+
}
183+
184+
int main() {
185+
std::cout << "Int: " << add<int>(2, 3) << std::endl;
186+
std::cout << "Double: " << add<double>(2.5, 3.5) << std::endl;
187+
188+
return 0;
189+
}
190+
```
191+
</td>
192+
</tr>
193+
194+
<tr>
195+
<th>C++ Files and Streams:</th>
196+
<th>C++ Algorithms:</th>
197+
</tr>
198+
199+
<tr>
200+
<td>
201+
C++ provides classes to perform file input and output. The `ifstream` class is used for reading from files, and the `ofstream` class is used for writing to files.
202+
203+
```cpp
204+
#include <iostream>
205+
#include <fstream>
206+
207+
int main() {
208+
std::ofstream outFile("example.txt");
209+
outFile << "Hello, World!" << std::endl;
210+
outFile.close();
211+
212+
std::ifstream inFile("example.txt");
213+
std::string content;
214+
std::getline(inFile, content);
215+
std::cout << "File content: " << content << std::endl;
216+
inFile.close();
217+
218+
return 0;
219+
}
220+
```
221+
</td>
222+
223+
<td>
224+
225+
The C++ Standard Library provides a collection of algorithms that can be used to perform various operations on containers.
226+
227+
```cpp
228+
#include <iostream>
229+
#include <algorithm>
230+
#include <vector>
231+
232+
int main() {
233+
std::vector<int> vec = {1, 3, 2, 5, 4};
234+
235+
// Sorting the vector
236+
std::sort(vec.begin(), vec.end());
237+
238+
// Displaying the sorted vector
239+
for (int i : vec) {
240+
std::cout << i << " ";
241+
}
242+
std::cout << std::endl;
243+
244+
// Finding an element
245+
auto it = std::find(vec.begin(), vec.end(), 3);
246+
if (it != vec.end()) {
247+
std::cout << "Element found: " << *it << std::endl;
248+
} else {
249+
std::cout << "Element not found" << std::endl;
250+
}
251+
252+
return 0;
253+
}
254+
```
255+
</td>
256+
</tr>
257+
258+
<tr>
259+
<th>C++ Namespaces:</th>
260+
<th>C++ Math Functions:</th>
261+
</tr>
262+
263+
<tr>
264+
<td>
265+
266+
Namespaces are used to organize code into logical groups and to prevent name collisions. The `std` namespace is the most commonly used namespace in C++.
267+
268+
```cpp
269+
#include <iostream>
270+
271+
namespace myNamespace {
272+
void myFunction() {
273+
std::cout << "Hello from myNamespace" << std::endl;
274+
}
275+
}
276+
277+
int main() {
278+
myNamespace::myFunction();
279+
return 0;
280+
}
281+
```
282+
</td>
283+
284+
<td>
285+
286+
The C++ Standard Library provides a set of functions to perform mathematical operations, such as `sqrt`, `pow`, `sin`, `cos`, etc.
287+
288+
```cpp
289+
#include <iostream>
290+
#include <cmath>
291+
292+
int main() {
293+
double x = 9.0;
294+
295+
std::cout << "Square root of " << x << " is " << sqrt(x) << std::endl;
296+
std::cout << x << " raised to the power 3 is " << pow(x, 3) << std::endl;
297+
std::cout << "Sine of 45 degrees is " << sin(45 * M_PI / 180) << std::endl;
298+
299+
return 0;
300+
}
301+
```
302+
</td>
303+
</tr>
304+
305+
</table>
24306

25307
resources : [[code](./code/)] & /[cpp competitive ref](./cp/) | [[cpp doc](./doc/)] [CMake tutorial](https://www.youtube.com/watch?v=nlKcXPUJGwA&list=PLalVdRk2RC6o5GHu618ARWh0VO0bFlif4) [[How to Properly Setup C++ Projects](https://youtu.be/5glH8dGoeCA?si=nkwRWgvsitERl3L9)] [[Making and Working with Libraries in C++](https://youtu.be/Wt4dxDNmDA8?si=eBW6m8PqW0slulwi)] [[C++](https://www.youtube.com/watch?v=18c3MTX0PK0&list=PLlrATfBNZ98dudnM48yfGUldqGD0S4FFb)]
26308

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)