-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C++ DSA cheatsheet #232
base: main
Are you sure you want to change the base?
C++ DSA cheatsheet #232
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's great having you contribute to this project
Welcome to the community 🤓Thanks for joining our community - we help and encourage each other to contribute to open source little and often 🤓 . Any questions let us know.
please merge the pr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks to me good!
Some modifications needed based on requirements:
- Rename your file form
C++ DSA cheatsheet.md
tocpp-dsa-cheatsheet.md
ordsa-cheatsheet.md
- Remove STL Library from this file and modify cpp-stl-cheatsheet.md by adding
time/space complexity
,operation-wise complexity
,list of operations
,use for and not use for
in different DSA etc. - Link
cpp-stl-cheatsheet.md
inside this file. - Maintain the
tabular format
.
![Legend](General/Legend.png) | ||
|
||
![DataStructures](General/Data%20Structures.png "Data Structures") | ||
|
||
![ComplexityChart](General/Complexity%20Chart.png "Complexity Chart") | ||
|
||
![DataStructureSelection](General/Data%20Structures%20Selection.png "Data Structures Selection") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those images are not showing.
- [1.2 Vector `std::vector`](#12-vector-stdvector) | ||
- [1.3 Deque `std::deque`](#13-deque-stddeque) | ||
- [1.4 List `std::list` and `std::forward_list`](#14-list-stdlist-and-stdforward_list) | ||
- [1.5 Map `std::map` and `std::unordered_map`](#15-map-stdmap-and-stdunordered_map) | ||
- [1.6 Set `std::set`](#16-set-stdset) | ||
- [1.7 Stack `std::stack`](#17-stack-stdstack) | ||
- [1.8 Queue `std::queue`](#18-queue-stdqueue) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a cpp-stl-cheatsheet.md sheet. You could check it.
I think it will be better if you add time/space complexity
and operation-wise complexity
in a tabular format
in cpp-stl-cheatsheet.md sheet and just mention that sheet in cpp-dsa-cheatsheet.md
.
We could rather use this sheet as a CPP DSA cheatsheet
for the most commonly used DSA.
```c++ | ||
std::stack<int> s; | ||
|
||
//--------------------------------- | ||
// Container-Specific Operations | ||
//--------------------------------- | ||
|
||
// Push | ||
s.push(20); | ||
|
||
// Size | ||
unsigned int size = s.size(); | ||
|
||
// Pop | ||
s.pop(); | ||
|
||
// Top | ||
int top = s.top(); | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
```c++ | |
std::stack<int> s; | |
//--------------------------------- | |
// Container-Specific Operations | |
//--------------------------------- | |
// Push | |
s.push(20); | |
// Size | |
unsigned int size = s.size(); | |
// Pop | |
s.pop(); | |
// Top | |
int top = s.top(); | |
``` |
Command | Description |
---|---|
stack<int> s; |
Stack Initialization |
s.push(20); |
Push a element on the top |
s.pop(); |
Pop a element from the top |
s.top(); |
Find the top element |
s.size(); |
Find the size of a stack |
I think this tabular format
is better to understand what type of operations are exists in Stack. After that, you can give an example like these codes.
// Initialization
std::stack<int> s;
// Push
s.push(20);
// Size
unsigned int size = s.size();
// Pop
s.pop();
// Top
int top = s.top();
What does this PR do?
Description
Checklist:
Follow-up