Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

scammer nextLime (); ) 6. Create a search from the tail-first search method to improve your understanding of how to iterate both directions. This method

image text in transcribed
scammer nextLime (); ) 6. Create a search from the tail-first search method to improve your understanding of how to iterate both directions. This method will start from the tail and iterate backward using the previous attribute. public SortedSet searchTailFirst(String searchItem) [ SortedSet sortedSet = new TreeSet(); Node current = tail; if (tail = = mull) { System out.printlo("List is empty" ); return mull; } // System.out.printlo("Nodes of doubly linked list: "); while (current != mull) { /Checks each node by incrementing the pointer. if (current data.name.toLowerCase().contains(searchItem.toLowerCase()_stripOf l| current data mobilePhone.contains(searchItem)) { sortedSet add((PhonebookData) current data); } current = current.previous; ) return sortedSet; ) Once you have added this new method, you can run two consecutive versions of your program, one using head-first search, the other using tail-first, or you could scan for a value before you begin your test, to let the program know which direction you want to search either from the tail or from the head. Your test output

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Economics questions

Question

Behaviour: What am I doing?

Answered: 1 week ago