Skip to content
This repository has been archived by the owner on Apr 1, 2021. It is now read-only.

Added article on linked list #1056

Closed
wants to merge 6 commits into from

Conversation

jainaman224
Copy link
Contributor

@alayek
Copy link
Member

alayek commented May 29, 2016

@abhisekp @koustuvsinha please review!

@ghost
Copy link

ghost commented May 29, 2016

LGTM 👍

#### Printing an `array`:

```cpp
cout << intarray[0]; // Returns 1 which is element at index of the array
Copy link
Member

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

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++

Copy link
Member

Choose a reason for hiding this comment

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

whereas, in python java Python and Java free space is collected

also mention that it's collected by garbage collector.

@alayek
Copy link
Member

alayek commented Jun 1, 2016

@raisedadead if you could, please review the C++ implementations.

@jainaman224 jainaman224 force-pushed the master branch 2 times, most recently from 72bce90 to 7217e56 Compare June 1, 2016 10:53
@koustuvsinha
Copy link
Member

@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`:
Copy link
Member

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
@jainaman224 jainaman224 force-pushed the master branch 3 times, most recently from 2e10c3e to c7ac089 Compare June 1, 2016 11:32
@jainaman224
Copy link
Contributor Author

I don't know how to split this in multiple PR. So, can you please help...?


// Free memory used by temp
delete temp;

Copy link
Member

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

@raisedadead
Copy link
Member

@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
@koustuvsinha
Copy link
Member

@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 :

  • Close this PR
  • Commit each separate file in separate branch in your local machine, and then push all to your fork
  • Open a single PR from each of those branches :)

If you have more questions, please contact us on Gitter

@jainaman224
Copy link
Contributor Author

Please see #1073 #1074 #1075. It is now split into multiple pull requests.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants