-
-
Notifications
You must be signed in to change notification settings - Fork 307
Conversation
@abhisekp @koustuvsinha please review! |
LGTM 👍 |
#### Printing an `array`: | ||
|
||
```cpp | ||
cout << intarray[0]; // Returns 1 which is element at index 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.
Use std::cout
, because what if he did not import the namespace std
|
||
#### Note | ||
|
||
We have to use free() in c and cpp to free the space used by deleted node, whereas, in python java free space is collected automatically. |
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 to use `free()` in c and cpp
+ We have to use `free()` in C and C++
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.
whereas, in
python javaPython and Java free space is collected
also mention that it's collected by garbage collector.
@raisedadead if you could, please review the C++ implementations. |
72bce90
to
7217e56
Compare
@jainaman224 too many files changed in a single PR, makes it a bit difficult for proper review. If this PR is a article on Linked List then please add only the changed file, and make other files in separate PR's. |
// Choose one the two declarations and then move ahead. | ||
``` | ||
|
||
#### Adding elements to `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.
Change the term Add
to insert
, since arrays are linear locations in memory the term insert is more technically and politically correct.
make this change else where.
implemented all suggestions Implemented suggestions Implemented suggestions Implemented suggestions
2e10c3e
to
c7ac089
Compare
I don't know how to split this in multiple PR. So, can you please help...? |
|
||
// Free memory used by temp | ||
delete temp; | ||
|
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.
temp = null
its a standard practice to follow.
The memory may be de-allocated but the location can still be referenced, hence setting to null
is a safe practice
@jainaman224 this is a great right up and tons of hard work in here. |
C to C++ in Linked List C to C++ in Linked List Update Update Update
@jainaman224 its awesome that you have implemented all the suggestions. Now reviewing would be easy when you open the next set of PR's. what I suggest is this :
If you have more questions, please contact us on Gitter |
#1044