-
Notifications
You must be signed in to change notification settings - Fork 7
Added Resizable Array in C++ #15
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
base: master
Are you sure you want to change the base?
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.
- Corecteaza indentarea in toata sursa
- Corecteaza-ti comentariile
- @param sau @return sunt directive de Java.
* Adds the specified element at the end of the array.
*
* @param element Element to be added at the end of the array.
*/
ar trebui sa devina
// Adds the specified element at the end of the array.
CPP/data-structures/ResizableArray.h
Outdated
| @@ -0,0 +1,130 @@ | |||
| /* | |||
| ResizableArray.h | |||
| Copyright Antonio Macovei | |||
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.
E open source, deci nu tinem copyright. Avem doar licenta MIT pe repo.
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.
Also, nu e nevoie sa mai pui comentariu cu numele fisierului
CPP/data-structures/ResizableArray.h
Outdated
|
|
||
| template <typename T> | ||
| class ResizableArray { | ||
| private: |
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.
taburi de 2/4 spatii, te rog
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.
private si public nu au nevoie de taburi
CPP/data-structures/ResizableArray.h
Outdated
| ResizableArray() { | ||
| numElements = 0; | ||
| maxCapacity = defaultCapacity; | ||
|
|
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.
remove blank line
CPP/data-structures/ResizableArray.h
Outdated
| } | ||
|
|
||
| public: | ||
| // Constructor |
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.
nu e nevoie de comentariul asta, e clar ca e constructor
CPP/data-structures/ResizableArray.h
Outdated
| data = new T[maxCapacity]; | ||
| } | ||
|
|
||
| // Destructor |
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.
la fel ca la constructor
CPP/data-structures/ResizableArray.h
Outdated
| void add_last(T element) { | ||
| if (numElements == maxCapacity) { | ||
| resizeArray(); | ||
| } |
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.
indentare gresita la toata functia, pls fix
CPP/data-structures/ResizableArray.h
Outdated
| */ | ||
| void add_first(T element) { | ||
| if (numElements == maxCapacity) { | ||
| resizeArray(); |
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.
la fel ca mai sus; pls fix
CPP/data-structures/ResizableArray.h
Outdated
| } | ||
|
|
||
| /** | ||
| * Removes and returns the last element of the array. |
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.
does it?
CPP/data-structures/ResizableArray.h
Outdated
| } | ||
|
|
||
| /** | ||
| * Removes and returns the first element of the array. |
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.
does it?
CPP/data-structures/ResizableArray.h
Outdated
| return numElements; | ||
| } | ||
|
|
||
| // Getters |
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.
Do we need this?
Added Resizable Array in C++