Hacktoberfest-2k18
Hacktoberfest-2k18 copied to clipboard
Find the bug in Insertion in Linked List code
Description
Find the bug in the following code to insert a value into an ordered linked list:
void insert(lnode*& curr, int val) {
if (curr == NULL)
curr = new lnode(val, NULL);
else if (lnode->val > val)
curr = new lnode(val, curr->next);
else {
curr = curr->next;
insert(curr, val);
}
}
Submit the code after correcting the bug.
Details
Technical Specifications: C++ programming language should be used Type of issue: Single Time Limit: 4 days
Directory Structure
Name your cpp file as <your_name>.cpp and save it inside 'algorithms' --> 'insertion_ll' folder.
Add your code file inside this folder.
Eg path: algorithms/insertion_ll/Sharanya.cpp
Note
Please claim the issue first by commenting here before starting to work on it.
i claim!!
@PoojithaR please create a pull request to this repository instead of your forked repository.