0% found this document useful (0 votes)
35 views

DSA Programming Assignment-V

The document outlines a programming assignment for creating a doubly linked list in Java, focusing on student registration numbers and marks. It specifies the class structure, method prototypes for insertion, deletion, searching, and displaying nodes, as well as a menu-driven program template for user interaction. The assignment emphasizes the implementation of various linked list operations through defined methods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

DSA Programming Assignment-V

The document outlines a programming assignment for creating a doubly linked list in Java, focusing on student registration numbers and marks. It specifies the class structure, method prototypes for insertion, deletion, searching, and displaying nodes, as well as a menu-driven program template for user interaction. The assignment emphasizes the implementation of various linked list operations through defined methods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CSE 2001: Data Structure & Algorithms

Programming Assignment-V
(Doubly Linked List)

1. Write a menu driven Java Program using class, methods and reference variables, to construct
a doubly linked list consisting of the following information in each node: student regd_no
(int), mark secured in a subject (float).

The class definition should be as follows.

class Node
{

protected int regd_no;


protected float mark;
protected Node next;
protected Node prev;

The prototype of the create method should be as follows.

public static Node create(Node start, Node end)

Define the methods for each of the following operations to be supported by the above

linked list are:

a) The insertion operation

i. At the beginning of the list

Method Prototype: public static Node insBeg(Node start, Node end)

ii. At the end of the list

Method Prototype: public static Node insEnd(Node start, Node end)

iii. At any position in the list

Method Prototype: public static Node insAny(Node start, Node end)


b) The deletion operation

i. From the beginning of the list


Method Prototype: public static Node delBeg(Node start, Node end)
ii. From the end of the list
Method Prototype: public static Node delEnd(Node start, Node end)
iii. From any position in the list
Method Prototype: public static Node delAny(Node start, Node end)

c) Search a node based on student regd_no and update the mark of the student. If the

specified node is not present in the list an error message should be displayed.

Method Prototype: public static void search(Node start)

d) Displaying all the nodes in the list

The prototype of the display method should be as follows.

public static void display(Node start, Node end)


The template for menu driven java program to use the above list and invoke the required methods
to perform different operations is given below.
public class DLinkedList {

public static Node create(Node start, Node end)


{
...
}

public static void display(Node start, Node end)


{
...
}

public static Node insBeg(Node start, Node end)


{
...
}
/* Code for the remaining user defined methods*/

public static void main(String[] args) {

Scanner sc=new Scanner(System.in);


------
------
while(true)
{
System.out.println("****MENU*****");
System.out.println("0: Exit");
System.out.println("1: Creation");
System.out.println("2: Display");
.....
.....
System.out.println("Enter your choice");
int choice=sc.nextInt();
switch(choice)
{
case 0:
System.exit(0);
case 1:
end=create(start,end);
break;
case 2:
display(start,end);
break;
.....
.....

default:
System.out.println("Wrong choice");
}

}
}

************

You might also like