Exercise 3 - Doubly Linked Lists 1. Open Double LinkedNode.java and BuildDLL.java in Eclipse and examine...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Exercise 3 - Doubly Linked Lists 1. Open Double LinkedNode.java and BuildDLL.java in Eclipse and examine the code in both classes. 2. The Double LinkedNode class is complete and does not have to be modified. 3. The BuildDLL class has some provided methods for creating a doubly linked list with a sequence of letters (note that we are using the Character class for this, which is a wrapper for the primitive char type) and printing out the list from front to rear. Run the program to see the default output. 4. Notice that the original list is printing correctly, but the remove () method is not provided so subsequent list outputs are incorrect. 5. You must fill in the code for removing an element from the linked list using the following rules and hints: Loop through the list until you find the correct node (how can you tell if the node is the one for which we are searching?) We will assume that the input parameter 'elem' will always be a valid element that is contained in the list. Normally we would have to account for elements that are not found in the list, but you may ignore this possibility for this lab. What are the 3 possible cases of the node's location in the list? How must each of these cases be handled? Make the appropriate connections with the previous and/or next node based on its position in the list. (Hint: remember front's previous is null and rear's next is null). 6. Run the program and check that the output is correct. The list after each step should be: KTENPAL (original) KTEPAL TEPAL ΤΕΡΑ (after removing 'N') (after removing 'K') (after removing 'L') Exercise 3 - Doubly Linked Lists 1. Open Double LinkedNode.java and BuildDLL.java in Eclipse and examine the code in both classes. 2. The Double LinkedNode class is complete and does not have to be modified. 3. The BuildDLL class has some provided methods for creating a doubly linked list with a sequence of letters (note that we are using the Character class for this, which is a wrapper for the primitive char type) and printing out the list from front to rear. Run the program to see the default output. 4. Notice that the original list is printing correctly, but the remove () method is not provided so subsequent list outputs are incorrect. 5. You must fill in the code for removing an element from the linked list using the following rules and hints: Loop through the list until you find the correct node (how can you tell if the node is the one for which we are searching?) We will assume that the input parameter 'elem' will always be a valid element that is contained in the list. Normally we would have to account for elements that are not found in the list, but you may ignore this possibility for this lab. What are the 3 possible cases of the node's location in the list? How must each of these cases be handled? Make the appropriate connections with the previous and/or next node based on its position in the list. (Hint: remember front's previous is null and rear's next is null). 6. Run the program and check that the output is correct. The list after each step should be: KTENPAL (original) KTEPAL TEPAL ΤΕΡΑ (after removing 'N') (after removing 'K') (after removing 'L')
Expert Answer:
Answer rating: 100% (QA)
To solve the problem you need to implement the remove method in the BuildDLL class This method should handle the three possible cases when removing an ... View the full answer
Related Book For
Introduction to Operations and Supply Chain Management
ISBN: 978-0132747325
3rd edition
Authors: Cecil B. Bozarth, Robert B. Handfield
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
The comparative balance sheet of Beets Industries, Inc. at December 31, 2013 and 2012, is as follows: An examination of the income statement and the accounting records revealed the following...
-
In the circuit shown in Fig. 19-79, the 33-Ω resistor dissipates 0.80W. What is the battery voltage? 68 2 33 Q 85 2
-
Find the intervals on which f is increasing or decreasing, and find the local maximum and minimum values of f. f(x) = sin x + cos x, 0 x 2
-
What are the different types of consulting and litigation support activities for fraud and forensic accounting professionals?
-
Here are comparative statement data for Prince Company and King Company, two competitors. All balance sheet data are as of December 31, 2014, and December 31, 2013. Instructions (a) Prepare a...
-
3. (L)Explain the four terms in the equation below, and why this equation has to be true by definition. Explain the assumption that allows us to use this equation to determine the agricultural...
-
As of November 1, 2017. Mr. Bai decided to open an ice cream shop in Hangzhou. The business will be known as Dairy Queen. During November, Diary Queen entered into the On Nov 11", Dairy Queen paid...
-
If I bought a stock 3 years ago today for $100 and it pays a $4 dividend once a year (assume a year from when I bought it) for three years (so you receive three dividends) and I now sell it for $140,...
-
A bag contains 8 red and 4 yellow marbles. Two marbles are chosen at random and not replaced. What is the probability that 1 marble will be yellow and 1 marble will be red?
-
Identify 10 social welfare programs that are a result of public policy. Provide a description of each program, including the target population the program seeks to serve. Be sure to include social...
-
Question: Implement a C++ template function variadic_max that does the following: 1. Takes an arbitrary number of arguments of any comparable type (int, double, custom types with overloaded
-
Question 1: JavaScript Program to Display Fibonacci Sequence Using Recursion. Question 2: JavaScript Program to Convert Decimal to Binary.
-
In a random sample of 1,000 residents of Arizona, 300 believe that there is intelligent life on Mars. Find: Question 11 p = Group of answer choices .30 .20 .40 .5 Question 12 The standard error...
-
Consider the setup in Problem 16. Show that the relative speed of the ball and the point of contact on the stick is the same before and immediately after the collision. (This result is analogous to...
-
What kind of capacity strategy-lead, lag, or match would you expect a re station to follow? What about a driver's license testing center? Why?
-
KraftyCity is a large retailer that sells power tools and other hardware supplies. One of its products is the Krafty Man workbench. Information on the workbench is as follows: Annual demand = 1,200...
-
Using the same holding and ordering costs as in problem 1, suppose demand for TricoFlexers doubles, to 32,000. Does the EOQ also double? Explain what happens.
-
Prove that the angular momentum operator \(L_{z}\) generates rotations around the \(z\)-axis.
-
Show that for real numbers \(\alpha, \beta\), and \(\delta\) the matrices form a group under matrix multiplication. Show that the matrices \(G\) with \(\alpha=\beta=0\) form an invariant subgroup of...
-
Show that the quotient group of the 4-group \(\mathrm{D}_{2}\) defined in Problem 2.9 is \(\mathrm{C}_{2}\).
Study smarter with the SolutionInn App