Skip to content
This repository has been archived by the owner on Oct 31, 2019. It is now read-only.

Find the bug in Insertion in Linked List code #10

Open
sharanyakamath opened this issue Oct 2, 2018 · 2 comments
Open

Find the bug in Insertion in Linked List code #10

sharanyakamath opened this issue Oct 2, 2018 · 2 comments
Labels
algorithms Algorithms related Issues hacktoberfest Open issues for hacktoberfest intermediate Intermediate Issue

Comments

@sharanyakamath
Copy link
Member

sharanyakamath commented Oct 2, 2018

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.

@mahim23 mahim23 added hacktoberfest Open issues for hacktoberfest algorithms Algorithms related Issues labels Oct 5, 2018
@sharanyakamath sharanyakamath added the intermediate Intermediate Issue label Oct 6, 2018
@PoojithaR
Copy link

i claim!!

@mahim23
Copy link
Collaborator

mahim23 commented Oct 12, 2018

@PoojithaR please create a pull request to this repository instead of your forked repository.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
algorithms Algorithms related Issues hacktoberfest Open issues for hacktoberfest intermediate Intermediate Issue
Projects
None yet
Development

No branches or pull requests

3 participants