Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with these questions please help! (20 pts) Consider a doubly linked list of items that are in no particular order. Assume the

I need help with these questions please help!

image text in transcribed

image text in transcribed

image text in transcribed

(20 pts) Consider a doubly linked list of items that are in no particular order. Assume the doubly linked list has only a head reference. You are allowed to use only one temporary curr reference without the need of others such as prev. a. Write instructions to insert a node referenced by newNode at the beginning of the linked list. b. Write instructions to delete a node referenced by newNode at the beginning of the linked list. c. Write instructions to insert a node referenced by newNode at the end of the linked list. d. Write instructions to delete a node referenced by newNode at the end of the linked list. Similar to Problem 1, you should consider special cases. (10 pts) Consider a linked list of items that are in no particular order. Assume the linked list has a head reference and a tail reference. a. Write instructions to insert a node referenced by newNode at the end of the linked list. You shouldn't use a loop. b. Write instructions to delete a node referenced by newNode at the end of the linked list. Note that the first step to solve this problem is to identify all possible cases, including inserting into an empty linked list, deleting from a linked list with zero or one node, and so on. Drawing pictures helps. class Node { int value; Node next; // constructors } 4. (5 pts) Implement the method int number Positive(Node head) that counts the number of positive integers in a linked list of integers iteratively. Assume the linked list is reference by head. 5. (5 pts) Implement the method Node search (Node head, int key) that returns the reference to the node with the value key in a linked list of distinct integers iteratively. Assume the linked list is reference by head. The method returns null if the search fails

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

Big Data Systems A 360-degree Approach

Authors: Jawwad ShamsiMuhammad Khojaye

1st Edition

0429531575, 9780429531576

More Books

Students also viewed these Databases questions

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago