Content-Length: 825 | pFad | http://github.com/codebasics/data-structures-algorithms-python/pull/42.diff

thub.com diff --git a/data_structures/3_LinkedList/3_linked_list.py b/data_structures/3_LinkedList/3_linked_list.py index a6d9466..23267c5 100644 --- a/data_structures/3_LinkedList/3_linked_list.py +++ b/data_structures/3_LinkedList/3_linked_list.py @@ -79,11 +79,16 @@ def remove_at(self, index): itr = itr.next count+=1 - + def insert_values(self, data_list): - self.head = None - for data in data_list: - self.insert_at_end(data) + self.head= None + self.head = Node(data_list[0], None) + for data in range(1, len(data_list)): + itr = self.head + while itr.next: + itr = itr.next + + itr.next = Node(data_list[data], None) if __name__ == '__main__':








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/codebasics/data-structures-algorithms-python/pull/42.diff

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy