Skip to content

Instantly share code, notes, and snippets.

@kinduff
Last active March 24, 2016 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kinduff/fd1a3d0995f54b558cc1 to your computer and use it in GitHub Desktop.
Save kinduff/fd1a3d0995f54b558cc1 to your computer and use it in GitHub Desktop.
def removeAt(index)
prev = nil
node = @head
i = 0
loop do
prev = node
node = node.next
i += 1
break unless !node.nil? and i < index
end
if prev.nil?
@head = node.next
else
prev.next = node.next
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment