Skip to content

Added Resizable Array in C++#15

Open
antonio-macovei wants to merge 3 commits into
radusqrt:masterfrom
antonio-macovei:resizable-array
Open

Added Resizable Array in C++#15
antonio-macovei wants to merge 3 commits into
radusqrt:masterfrom
antonio-macovei:resizable-array

Conversation

@antonio-macovei
Copy link
Copy Markdown

Added Resizable Array in C++

Copy link
Copy Markdown
Owner

@radusqrt radusqrt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Corecteaza indentarea in toata sursa
  2. Corecteaza-ti comentariile
  3. @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.

Comment thread CPP/data-structures/ResizableArray.h Outdated
@@ -0,0 +1,130 @@
/*
ResizableArray.h
Copyright Antonio Macovei
Copy link
Copy Markdown
Owner

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.

Copy link
Copy Markdown
Owner

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

Comment thread CPP/data-structures/ResizableArray.h Outdated

template <typename T>
class ResizableArray {
private:
Copy link
Copy Markdown
Owner

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

Copy link
Copy Markdown
Owner

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

Comment thread CPP/data-structures/ResizableArray.h Outdated
ResizableArray() {
numElements = 0;
maxCapacity = defaultCapacity;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove blank line

Comment thread CPP/data-structures/ResizableArray.h Outdated
}

public:
// Constructor
Copy link
Copy Markdown
Owner

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

Comment thread CPP/data-structures/ResizableArray.h Outdated
data = new T[maxCapacity];
}

// Destructor
Copy link
Copy Markdown
Owner

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

Comment thread CPP/data-structures/ResizableArray.h Outdated
void add_last(T element) {
if (numElements == maxCapacity) {
resizeArray();
}
Copy link
Copy Markdown
Owner

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

Comment thread CPP/data-structures/ResizableArray.h Outdated
*/
void add_first(T element) {
if (numElements == maxCapacity) {
resizeArray();
Copy link
Copy Markdown
Owner

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

Comment thread CPP/data-structures/ResizableArray.h Outdated
}

/**
* Removes and returns the last element of the array.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it?

Comment thread CPP/data-structures/ResizableArray.h Outdated
}

/**
* Removes and returns the first element of the array.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it?

Comment thread CPP/data-structures/ResizableArray.h Outdated
return numElements;
}

// Getters
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants