Skip to content

insertNode #2

@not4smurf

Description

@not4smurf

Hi - found your code when searching for Python Linked List. Curious why you made insertNode so "complex"? It looks more like appendNode. Couldn't you just do:

def insertNode(head, valuetoInsert):
    newNode = linkedListNode(valuetoInsert)
    newNode.nextNode = head
    return newNode

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions