Skip to content

Conversation

@antonio-macovei
Copy link

Added Resizable Array in C++

Copy link
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.

@@ -0,0 +1,130 @@
/*
ResizableArray.h
Copyright Antonio Macovei
Copy link
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
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


template <typename T>
class ResizableArray {
private:
Copy link
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
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

ResizableArray() {
numElements = 0;
maxCapacity = defaultCapacity;

Copy link
Owner

Choose a reason for hiding this comment

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

remove blank line

}

public:
// Constructor
Copy link
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

data = new T[maxCapacity];
}

// Destructor
Copy link
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

void add_last(T element) {
if (numElements == maxCapacity) {
resizeArray();
}
Copy link
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

*/
void add_first(T element) {
if (numElements == maxCapacity) {
resizeArray();
Copy link
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

}

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

Choose a reason for hiding this comment

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

does it?

}

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

Choose a reason for hiding this comment

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

does it?

return numElements;
}

// Getters
Copy link
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