Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In a single linked list implemented in Java, this is the definition of a node: class Node { int data; Node nextNode; / / Constructor

In a single linked list implemented in Java, this is the definition of a node: class Node { int data; Node nextNode; // Constructor to create a new node // nextNode is by default initialized as null Node(int d){ data = d; }} a) Assuming that the above definition is kept for the nodes of the secondary lists, device a new definition of node for the nodes of the main list. Call this type of node MainNode and use the names of pointers NextNode and NextList respectively in your implementation. (5.0 marks) b) Write the pseudocode of the function INSERT(head,x) that inserts a new number in this data structure. If the number is even it must go to the second secondary list, the list that starts with node 1 in the main list. Otherwise, it must go to the first secondary list. Assume the data structure already has the main list created and numbers are inserted at the start of the secondary list. (5.0 marks) c) Write the pseudocode of the function SEARCH(head,x) that returns TRUE if the number x is in the data structure (in any of the secondary lists) and FALSE otherwise. (5.0 marks) d) Write the pseudocode of the function DELETE(head, b) that receives as input arguments the head of the last of two lists and a Boolean value. The function DELETE(head,b) deletes one of the main nodes. If b equals 0, then the node storing number 0 is deleted. Otherwise, the main node storing number 1 is deleted. Consider the following cases: the main list is empty and it has only one node (node 0 or 1).
Help me solve the question using the image provided please show me all the code and pseudocode. Thank u
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

Recommended Textbook for

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions

Question

How to find if any no. is divisble by 4 or not ?

Answered: 1 week ago

Question

Explain the Pascals Law ?

Answered: 1 week ago

Question

What are the objectives of performance appraisal ?

Answered: 1 week ago

Question

=+What sanctions are available to employers

Answered: 1 week ago

Question

=+ If strikes occur, are they legally regulated?

Answered: 1 week ago

Question

=+industrial action Under what circumstances can unions strike?

Answered: 1 week ago