mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-03 07:58:02 +00:00
committed by
Donne Martin
parent
fcd4e52e91
commit
1d2b138344
@@ -33,7 +33,7 @@ class LinkedList(object):
|
||||
return None
|
||||
node = Node(data)
|
||||
if self.head is None:
|
||||
self.head = Node(data)
|
||||
self.head = node
|
||||
return node
|
||||
curr_node = self.head
|
||||
while curr_node.next is not None:
|
||||
@@ -57,7 +57,7 @@ class LinkedList(object):
|
||||
if self.head is None:
|
||||
return
|
||||
if self.head.data == data:
|
||||
self.head = None
|
||||
self.head = self.head.next
|
||||
return
|
||||
prev_node = self.head
|
||||
curr_node = self.head.next
|
||||
|
||||
@@ -220,7 +220,7 @@
|
||||
" return None\n",
|
||||
" node = Node(data)\n",
|
||||
" if self.head is None:\n",
|
||||
" self.head = Node(data)\n",
|
||||
" self.head = node\n",
|
||||
" return node\n",
|
||||
" curr_node = self.head\n",
|
||||
" while curr_node.next is not None:\n",
|
||||
@@ -244,7 +244,7 @@
|
||||
" if self.head is None:\n",
|
||||
" return\n",
|
||||
" if self.head.data == data:\n",
|
||||
" self.head = None\n",
|
||||
" self.head = self.head.next\n",
|
||||
" return\n",
|
||||
" prev_node = self.head\n",
|
||||
" curr_node = self.head.next\n",
|
||||
@@ -485,22 +485,23 @@
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"celltoolbar": "Edit Metadata",
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"display_name": "Python 2",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
"name": "python2"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
"version": 2
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.5.0"
|
||||
"pygments_lexer": "ipython2",
|
||||
"version": "2.7.12"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
Reference in New Issue
Block a user