86a5b0345fdbdf9931f00a26d80c61f6cf23c957,data_structures/LinkedList/singly_LinkedList.py,Linked_List,insert_tail,#Any#Any#,7

Before Change


    pass
    def insert_tail(Head,data)://insert the data at tail
        tamp=Head//create a tamp as a head
        if(tamp==None)://if linkedlist is empty
            newNod=Node()//create newNode Node type and given data and next
            newNod.data=data
            newNod.next=None
            Head=newNod
        else:
            while tamp.next!=None://find  the last Node
                tamp=tamp.next
            newNod = Node()//create a new node
            newNod.data = data
            newNod.next = None
            tamp.next=newNod//put the newnode into last node
        return Head//return first node  of  linked list  
    def insert_head(Head,data):
        tamp = Head
        if (tamp == None):

After Change


    pass
    
    def insert_tail(Head,data):
        if(Head.next is None):
            Head.next = Node(data)
        else:
            insert_tail(Head.next, data)

    def insert_head(Head,data):
        tamp = Head
        if (tamp == None):
            newNod = Node()//create a new Node
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: TheAlgorithms/Python
Commit Name: 86a5b0345fdbdf9931f00a26d80c61f6cf23c957
Time: 2017-10-12
Author: corey.huym@gmail.com
File Name: data_structures/LinkedList/singly_LinkedList.py
Class Name: Linked_List
Method Name: insert_tail


Project Name: TheAlgorithms/Python
Commit Name: 48aa4c4a01982159c7c5084f9090505cff92905e
Time: 2018-11-01
Author: 39827514+ashwek@users.noreply.github.com
File Name: data_structures/linked_list/singly_linked_list.py
Class Name: Linked_List
Method Name: insert_head


Project Name: graphbrain/graphbrain
Commit Name: 2dd592e4197d2272d214e945ec19201eac78a9e9
Time: 2016-10-21
Author: telmo@telmomenezes.net
File Name: gb/knowledge/semantic_tree.py
Class Name: Node
Method Name: append_to_root