Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

remove_by_value implementation in singly_linked_list_exercise.py #54

Copy link
Copy link
@satadrubasu

Description

@satadrubasu
Issue body actions

https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/3_LinkedList/Solution/singly_linked_list_exercise.py

Proposed below :

        if not self.head:
            return

        if self.head.val == value:
            self.head = self.head.next
            return

        itr = self.head
        prev_node = None
        while itr:
            if itr.val == value:
                prev_node.next = itr.next
            prev_node = itr
            itr = itr.next
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.