Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 3 : Printing a Path Part 3 . 1 : Node findPredPath ( int i ) Node findPredPath ( int i ) should find

Part 3: Printing a Path
Part 3.1: Node findPredPath(int i)
Node findPredPath(int i) should find the path to the predecessor of index i(exactly the same as
Node findPred(int 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 3.2: 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 findPredPath(int 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 0 marks. For example, if you accidentally add a space
somewhere, you will get 0.
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(4) finds a path to the predecessor of Node 4, which is Node 3(containing ' c ').
image text in transcribed

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

Students also viewed these Databases questions

Question

What is a root name server?

Answered: 1 week ago

Question

What is project portfolio management?

Answered: 1 week ago

Question

c. What were the reasons for their move? Did they come voluntarily?

Answered: 1 week ago

Question

5. How do economic situations affect intergroup relations?

Answered: 1 week ago