Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Introduction to Data Structures!
You have completed Introduction to Data Structures!
Preview
To conclude our list of operations let's add the ability to delete data from a linked list
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
But to actually get to the node that
we want to remove and modify the next
0:00
connections, we need to traverse
the entire list in our worst case.
0:00
So in the worst case,
this takes linear time.
0:04
Let's add this operation
to our data structure.
0:06
There are two ways we can
define remove method.
0:10
One, where we provide a key
to remove as an argument, and
0:13
one where we provide an index.
0:17
Now in the former, the key refers
to the data the node stores.
0:19
So in order to remove that node,
we would first need to search for
0:23
data then matches the key.
0:27
I'm going to implement that first method,
which we'll call remove.
0:28
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up