Join Raghavendra Dixit for an in-depth discussion in this video Searching for an item, part of Introduction to Data Structures & Algorithms in Java.
- [Instructor] We have learned how to insert…and delete a node at the head.…Now let's see how we search for an item in a linked list.…Now to search for an item in a linked list,…we have to go through all the elements…or the nodes of the list…'til we find the element we are searching for,…or it may so happen that the data we are searching for…is not there in the list.…But either ways, we have to travel through…all the elements of the list to find that out.…
Let's understand this with the help of an example.…Consider we have a linked list, as shown here,…and we are searching for some data item, say 12.…So let's use an object reference,…which starts from the head element,…and move through the elements one by one…'til it finds 12.…As you can see, searching for an item in a linked list…is a linear time operation.…That is, in the worst case,…it takes order of n time, right?…Because if we increase the size of the linked list,…the time to go through each item…will also increase proportionally.…
Now suppose we want to search for the data 15.…
Note: This course was created by Packt Publishing. We are pleased to host this training in our library.
- Why study data structures and algorithms?
- How to calculate the time complexity
- Using Big O notation
- Using basic sorting and search algorithms
- Searching elements in unordered arrays and ordered arrays
- Implementing a linked list in Java
- Implementing stacks using arrays
- Queues using arrays
- Binary search trees
- Representing heaps using arrays
Skill Level Intermediate
1. Introduction to Algorithms
2. Analysis of Algorithms
3. Basic Sorting and Search Algorithms
4. Linked Lists
5. Stacks and Queues
7. Binary Search Trees
8. More Sorting Algorithms
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.