Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Part 3 : Printing a Path Part 3 . 1 : Node findPredPath ( int i ) Node findPredPath ( int i ) should find
Part : Printing a Path
Part : Node findPredPathint i
Node findPredPathint i should find the path to the predecessor of index exactly the same as
Node findPredint i and return the predecessor Node. However, in this version you should store the path
somehow. You may look at ods. SkiplistSSet. java for inspiration it uses an array of Nodes called stack to save
part of the path on a call to add T x This may not be sufficient for your needs, but it is a good starting place.
Part : String toStringWithPath
This method is currently exactly the same as String toStringWithNodes You are to modify it so that its out
put highlights the path found on the previous call to Node findPredPathint i To highlight a path replace all
instances of or along the path. You do NOT have to indicate downward steps. This method need work ONCE per call to
findPredPath If you call toStringWithPath twice in a row without a second call to findPredPath it
does not need to highlight the path on the second call although it can if you like That means that you can destroy
the path that was stored as you highlight it if you wish.
IMPORTANT: Do not change how anything else is printed. The tests will check if the returned String is an
exact match to the correct version. If it is not exact, you get marks. For example, if you accidentally add a space
somewhere, you will get
An example of the expected output is provided below. It also highlight another function, toStringWithLength,
that provides the length of each next pointer which you may use for debugging
Note that findPredPath finds a path to the predecessor of Node which is Node containing c
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started