how to search in double linked list in java ?
Same as searching any other list. Start with the first entry, use a loop to check each entry to see if it's the one you want.
all of them first and last ..
I have no idea what that last post means. I know it's not easy writing in a foreign language, but please try to explain completely.
i want to search element .
Same as searching any other list. Start with the first element, use a loop to check each element to see if it's the one you want.
please give me source code .
No. This is not a "we do your homework" site. I will help you to learn how to do it.
Let's suppose your list has a variable for the first element, and each element has a variable for the next element. Then the logic looks like this in pseudo-code:
Element current = list.firstElement while (current != null) test if current is the element you are searching for if found, break out of loop current = current.next // go on to next element end loop
might even extend that by starting in the middle and determining what direction to go in, of course only if the list is sorted.