Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

Java help, can you please explain this I'm a beginner and I'm lost:(

Implement a nested class DoubleNode for building doubly-linked lists, where each node contains
a reference to the item preceding it and the item following it in the list (null if there is no such
item). Then implement methods for the following tasks:
• Print the contents of the list
• Insert at the beginning
• Insert at the end
• Remove from the beginning
• Remove from the end
• Insert before a give node (Insert before the first occurrence of the node, if the
node exists; else insert at the end)
• Insert after a given node (Insert after the first occurrence of the node, if the node
exists; else insert at the end)
• Remove a given node (Remove the first occurrence of the node, remove nothing if
node not found)
• Move to front (move the first occurrence of the node to the front)
• Move to end (moved and first occurrence of the node to the end)
Write a tester program and test your implementation. You must test each of these cases and print
the list after each test and verify the correctness of the code.
Examples:
Suppose the link list contains the following elements:
C-> O -> M -> P -> U -> T -> E
1. Print the contents of the list:
C-> O -> M -> P -> U -> T -> E
2. Insert M at the beginning of the list:
M -> C-> O -> M -> P -> U -> T -> E
3. Insert R at the end:
M -> C-> O -> M -> P -> U -> T -> E -> R
4. Remove from the beginning:
C-> O -> M -> P -> U -> T -> E -> R
 
 
 
 
 
 
 
 
5. Remove from the end:
C-> O -> M -> P -> U -> T -> E
6. Insert M before P:
C-> O -> M -> M -> P -> U -> T -> E
7. Insert H before M:
C-> O -> H -> M -> M -> P -> U -> T -> E -> B
8. Insert B before A:
C-> O -> M -> M -> P -> U -> T -> E -> B
9. Insert C after P:
C-> O -> M -> M -> P-> C -> U -> T -> E -> B
10.Insert L after M:
C-> O -> M -> L -> M -> P -> C-> -> U -> T -> E -> B
11.Remove M
C-> O -> L -> M -> P -> C-> -> U -> T -> E -> B
12.Remove G
C-> O -> L -> M -> P -> C-> -> U -> T -> E -> B
13.Move P to the front of the list:
P -> C-> O -> L -> M -> C-> -> U -> T -> E -> B
14.Move L to the end of the list:
P -> C-> O -> M -> C-> -> U -> T -> E -> B -> L
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education