Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. A doubly linked list is based on the following data: public class DoublyLinkedList { private Node head; private class Node{ private T data; private

4. A doubly linked list is based on the following data:

public class DoublyLinkedList{

private Node head;

private class Node{

private T data;

private Node next;

private Node prev;

public Node(T d) {

data = d;

next = null;

prev = null;

}

}

}

(a) Write a member method removeFirstNode() which deletes the first node from a doubly linked list (10 points).

(b) Assume the curNode points to a node in the doubly Linked List. Write a few lines of code to remove this node from the list (10 points).

(c) Write a method getSize(), which returns the number of nodes in the doubly linked list (10 points).

(d) Write a member method find (int position) which returns a Node reference at position in the doubly linked list. Your method should return NULL if the position is out of range (10 points).

(e) Write a method displayBackward(), which displays the doubly linked list in the reversed order. Please note that the doubly linked list does NOT have a tail reference. (10 points)

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

Informix Database Administrators Survival Guide

Authors: Joe Lumbley

1st Edition

0131243144, 978-0131243149

More Books

Students also viewed these Databases questions

Question

Describe the factors influencing of performance appraisal.

Answered: 1 week ago

Question

What is quality of work life ?

Answered: 1 week ago