SlideShare a Scribd company logo
Write a JAVA LinkedListRec class that has the following methods: size, empty, insertBefore,
insertAfter, addAtHead, addAtEnd, remove, replace, peekFront, peekEnd, removeFront,
removeEnd, toString. Use recursion to implement most of these methods. Write a driver to test
your implemented LinkedListRec class methods.
Solution
import java.util.Scanner;
public class LinkedListRec {
int data;
LinkedListRec prev=null,next=null;
int size(LinkedListRec l)//method which returns the length of the list
{
if(l==null)return 0;
return 1+size(l.next);
}
boolean empty(LinkedListRec l)//method checks whether the list is empty or not...
{
if(l==null)return true;
else return false;
}
LinkedListRec insertBefore(LinkedListRec l,int value,int num_insertbefore)//method which
adds a new number before the given number..
{
if(l==null)return l;
if(l.data == num_insertbefore)
{
LinkedListRec n = new LinkedListRec();
n.data = value;
if(l.prev==null)
{
n.next = l;
l=n;
}
else
{
n.prev = l.prev;
n.next= l;
l.prev = n;
}
return l;
}
return insertBefore(l.next,value,num_insertbefore);
}
LinkedListRec insertAfter(LinkedListRec l,int value,int num_insertafter)//method which adds
the new number after the given number
{
if(l==null)return l;
if(l.data == num_insertafter)
{
LinkedListRec n = new LinkedListRec();
n.data = value;
if(l.next==null)
{
l.next = n;
n.prev = l;
}
else
{
n.next = l.next;
l.next.prev = n;
n.prev = l;
}
return l;
}
return insertAfter(l.next,value,num_insertafter);
}
LinkedListRec addAtHead(LinkedListRec l,int value)//method which adds a new number at
the head position of the list...
{
LinkedListRec n = new LinkedListRec();
n.data=value;
n.next = l;
l=n;
return l;
}
LinkedListRec addAtEnd(LinkedListRec l,int value)//method which adds a new number at
the end position of the list...
{
if(l==null){ l = new LinkedListRec();l.data = value;return l;}
if(l.next==null)
{
LinkedListRec n = new LinkedListRec();
n.data=value;
n.prev = l;
l.next = n;
return l;
}
return addAtEnd(l.next,value);
}
LinkedListRec remove(LinkedListRec l,int value)//method which removes given numbet
from the list....
{
if(l==null)return l;
if(l.data == value)
{
if(l.prev!=null){
l.prev = l.next;
}
else
l=l.next;
return l;
}
return remove(l.next,value);
}
boolean replace(LinkedListRec l,int value,int newvalue)//method which replaces current
number with new number,...
{
if(l==null)return false;
if(l.data == value)
{
l.data = newvalue;
return true;
}
return replace(l.next,value,newvalue);
}
int peekFront(LinkedListRec l)//method which returns the first value of the list...
{
if(l!=null)
return l.data;
else return -1;
}
int peekEnd(LinkedListRec l)//method which returns the last value of the list........
{
if(l==null)return -1;
if(l.next == null)return l.data;
return peekEnd(l.next);
}
LinkedListRec removeFront(LinkedListRec l)//method which removes the first element of the
list..
{
if(l==null)return l;
l=l.next;
return l;
}
boolean removeEnd(LinkedListRec l)//method which removes the last element of the list//
{
if(l.next==null)
{
if(l.prev!=null){l.prev.next=null;return true;}
l.data = -1;
return true;
}
return removeEnd(l.next);
}
String tostring(LinkedListRec l)//displaying list
{
if(l==null)return "";
System.out.print(l.data+"->");
return l.data+"->"+tostring(l.next);
}
public static void main(String argv[])
{
//driver testing code...
LinkedListRec ll = new LinkedListRec();
ll.data = 2;
Scanner sc = new Scanner(System.in);
int c=-2;
while(true)
{
System.out.println("Select on option(-1 to exit) 1: size of list 2: is list empty 3: insert
Before a number 4:insert After a number 5: add At head 6: add at End 7: remove from list 8:
Replace a value 9: peekfrontvalue 10:peekendvalue 11:removefrontvalue 12:removeendvalue
13:display");
System.out.print("Enter ur choice");
c = sc.nextInt();
if(c==-1)break;
if(c==1){
System.out.println(" Size of List:"+ll.size(ll));
}
else if(c==2){
if(ll.empty(ll))
System.out.println(" List is Empty ");
else System.out.println(" List is not Empty ");
}
else if(c==3){
int v,p;
System.out.println(" Enter number to insert:");
v = sc.nextInt();
System.out.println(" Enter number to insertBefore it:");
p = sc.nextInt();
ll=ll.insertBefore(ll, v, p);
}
else if(c==4){
int v,p;
System.out.println(" Enter number to insert:");
v = sc.nextInt();
System.out.println(" Enter number to insertAfter it:");
p = sc.nextInt();
ll.insertAfter(ll, v, p);
}
else if(c==5){
int v;
System.out.println(" Enter number to insert:");
v = sc.nextInt();
ll= ll.addAtHead(ll, v);
}
else if(c==6){
int v;
System.out.println(" Enter number to insert:");
v = sc.nextInt();
ll=ll.addAtEnd(ll, v);
}
else if(c==7){
int v;
System.out.println(" Enter number to remove:");
v = sc.nextInt();
ll=ll.remove(ll, v);
}
else if(c==8){
int v,p;
System.out.println(" Enter number to replace:");
v = sc.nextInt();
System.out.println(" Enter which number to replace:");
p = sc.nextInt();
ll.replace(ll, v, p);
}
else if(c==9){
System.out.println(" Front value of the list:"+ll.peekFront(ll));
}
else if(c==10){
System.out.println(" End value of the list:"+ll.peekEnd(ll));
}
else if(c==11){
ll=ll.removeFront(ll);
System.out.println(" Front value of the list is removed");
}
else if(c==12){
if(ll.removeEnd(ll))
{
System.out.println(" Front value of the list is removed");
}
}
else if(c==13){
System.out.println(" The list:");
ll.tostring(ll);
System.out.println();
}
}
}
}
ouput:
run:
Select on option(-1 to exit)
1: size of list
2: is list empty
3: insert Before a number
4:insert After a number
5: add At head
6: add at End
7: remove from list
8: Replace a value
9: peekfrontvalue
10:peekendvalue
11:removefrontvalue
12:removeendvalue
13:display
Enter ur choice8
Enter number to replace:
2
Enter which number to replace:
7
Select on option(-1 to exit)
1: size of list
2: is list empty
3: insert Before a number
4:insert After a number
5: add At head
6: add at End
7: remove from list
8: Replace a value
9: peekfrontvalue
10:peekendvalue
11:removefrontvalue
12:removeendvalue
13:display
Enter ur choice13
The list:
7->
Select on option(-1 to exit)
1: size of list
2: is list empty
3: insert Before a number
4:insert After a number
5: add At head
6: add at End
7: remove from list
8: Replace a value
9: peekfrontvalue
10:peekendvalue
11:removefrontvalue
12:removeendvalue
13:display
Enter ur choice9
Front value of the list:7
Select on option(-1 to exit)
1: size of list
2: is list empty
3: insert Before a number
4:insert After a number
5: add At head
6: add at End
7: remove from list
8: Replace a value
9: peekfrontvalue
10:peekendvalue
11:removefrontvalue
12:removeendvalue
13:display
Enter ur choice6
Enter number to insert:
9
Select on option(-1 to exit)
1: size of list
2: is list empty
3: insert Before a number
4:insert After a number
5: add At head
6: add at End
7: remove from list
8: Replace a value
9: peekfrontvalue
10:peekendvalue
11:removefrontvalue
12:removeendvalue
13:display
Enter ur choice13
The list:
7->9->
Select on option(-1 to exit)
1: size of list
2: is list empty
3: insert Before a number
4:insert After a number
5: add At head
6: add at End
7: remove from list
8: Replace a value
9: peekfrontvalue
10:peekendvalue
11:removefrontvalue
12:removeendvalue
13:display
Enter ur choice1
Size of List:2
Select on option(-1 to exit)
1: size of list
2: is list empty
3: insert Before a number
4:insert After a number
5: add At head
6: add at End
7: remove from list
8: Replace a value
9: peekfrontvalue
10:peekendvalue
11:removefrontvalue
12:removeendvalue
13:display
Enter ur choice-1

More Related Content

PDF
STAGE 2 The Methods 65 points Implement all the methods t.pdf
PDF
Implement the additional 5 methods as indicated in the LinkedList fi.pdf
PDF
public class MyLinkedListltE extends ComparableltEgtg.pdf
PDF
a) Complete both insert and delete methods. If it works correctly 10.pdf
PDF
Hi,I have added the methods and main class as per your requirement.pdf
PDF
Write a Java Class to Implement a Generic Linked ListYour list mus.pdf
PDF
Note             Given Code modified as required and required met.pdf
PDF
Class DiagramIn the Assignment #10, you are given three files Ass.pdf
STAGE 2 The Methods 65 points Implement all the methods t.pdf
Implement the additional 5 methods as indicated in the LinkedList fi.pdf
public class MyLinkedListltE extends ComparableltEgtg.pdf
a) Complete both insert and delete methods. If it works correctly 10.pdf
Hi,I have added the methods and main class as per your requirement.pdf
Write a Java Class to Implement a Generic Linked ListYour list mus.pdf
Note             Given Code modified as required and required met.pdf
Class DiagramIn the Assignment #10, you are given three files Ass.pdf

Similar to Write a JAVA LinkedListRec class that has the following methods siz.pdf (20)

PDF
PLEASE MAKE SURE THE PROGRAM IS ASKING FOR INPUT FROM USER TO ADD OR.pdf
PDF
Sorted number list implementation with linked listsStep 1 Inspec.pdf
PDF
Given below is the completed implementation of MyLinkedList class. O.pdf
PDF
Rewrite this code so it can use a generic type instead of integers. .pdf
PDF
please i need help Im writing a program to test the merge sort alg.pdf
PDF
There are a couple of new methods that you will be writing for this pr.pdf
PDF
Lab02kdfshdfgajhdfgajhdfgajhdfgjhadgfasjhdgfjhasdgfjh.pdf
PDF
#includeiostream #includecstdio #includecstdlib using na.pdf
PDF
LabProgram.javaimport java.util.NoSuchElementException;public .pdf
DOCX
The MyLinkedList class used in Listing 24.6 is a one-way directional .docx
DOCX
Please complete all the code as per instructions in Java programming.docx
DOC
Final ds record
PDF
The LinkedList1 class implements a Linked list. class.pdf
PDF
Create a new java class called ListNode. Implement ListNode as a gen.pdf
PDF
package linkedLists- import java-util-Iterator- --- A class representi.pdf
PDF
JAVALAB #8 - ARRAY BASED LISTSThe next exercise is based on this.pdf
PDF
2.(Sorted list array implementation)This sorted list ADT discussed .pdf
PDF
import java-util--- public class MyLinkedList{ public static void.pdf
DOCX
Write java program using linked list to get integer from user and.docx
PPTX
single linked list
PLEASE MAKE SURE THE PROGRAM IS ASKING FOR INPUT FROM USER TO ADD OR.pdf
Sorted number list implementation with linked listsStep 1 Inspec.pdf
Given below is the completed implementation of MyLinkedList class. O.pdf
Rewrite this code so it can use a generic type instead of integers. .pdf
please i need help Im writing a program to test the merge sort alg.pdf
There are a couple of new methods that you will be writing for this pr.pdf
Lab02kdfshdfgajhdfgajhdfgajhdfgjhadgfasjhdgfjhasdgfjh.pdf
#includeiostream #includecstdio #includecstdlib using na.pdf
LabProgram.javaimport java.util.NoSuchElementException;public .pdf
The MyLinkedList class used in Listing 24.6 is a one-way directional .docx
Please complete all the code as per instructions in Java programming.docx
Final ds record
The LinkedList1 class implements a Linked list. class.pdf
Create a new java class called ListNode. Implement ListNode as a gen.pdf
package linkedLists- import java-util-Iterator- --- A class representi.pdf
JAVALAB #8 - ARRAY BASED LISTSThe next exercise is based on this.pdf
2.(Sorted list array implementation)This sorted list ADT discussed .pdf
import java-util--- public class MyLinkedList{ public static void.pdf
Write java program using linked list to get integer from user and.docx
single linked list
Ad

More from info785431 (20)

PDF
Carbon dioxide (CO_2) is a non-polar molecule. Is this consistent wit.pdf
PDF
Compare and contrast the messages about science and integrity in Fra.pdf
PDF
Briely, what was Darwins explanation for the appearance of design.pdf
PDF
A router receives a message addressed 172.16.15.75. The relevant rou.pdf
PDF
A study of sandflies in Panama classified flies caught in light traps.pdf
PDF
___Tissue found in the brain, spinal cord, and peripheral nerves. The.pdf
PDF
You have been exposed to each of the 8 microbes below. One of them h.pdf
PDF
Write a snippet of C code that will enable the ADC to continuously r.pdf
PDF
Write a BFS algorithm using only arrays and no other data structure..pdf
PDF
Why has one prominent textbook author described IO management as the.pdf
PDF
which is true of the data shown in the histogram Which is true of th.pdf
PDF
What is the value of studying humanities in a business or technical .pdf
PDF
What are the two components of dynamic pressureVelocity and densi.pdf
PDF
USING JAVAImplement the quicksort optimization median-of-three, i.pdf
PDF
There are 40 students in our class. How many ways they can be lined .pdf
PDF
The Task For this assignment you will write a rudimentary text edi.pdf
PDF
The SIP handles what functionsA.) establishes a call through the .pdf
PDF
The NBA decides to look into the use of meldonium in the league foll.pdf
PDF
The organelle that serves as the digestive system in the cell is the .pdf
PDF
The major type of interactive forces between molecules of NH_3 are .pdf
Carbon dioxide (CO_2) is a non-polar molecule. Is this consistent wit.pdf
Compare and contrast the messages about science and integrity in Fra.pdf
Briely, what was Darwins explanation for the appearance of design.pdf
A router receives a message addressed 172.16.15.75. The relevant rou.pdf
A study of sandflies in Panama classified flies caught in light traps.pdf
___Tissue found in the brain, spinal cord, and peripheral nerves. The.pdf
You have been exposed to each of the 8 microbes below. One of them h.pdf
Write a snippet of C code that will enable the ADC to continuously r.pdf
Write a BFS algorithm using only arrays and no other data structure..pdf
Why has one prominent textbook author described IO management as the.pdf
which is true of the data shown in the histogram Which is true of th.pdf
What is the value of studying humanities in a business or technical .pdf
What are the two components of dynamic pressureVelocity and densi.pdf
USING JAVAImplement the quicksort optimization median-of-three, i.pdf
There are 40 students in our class. How many ways they can be lined .pdf
The Task For this assignment you will write a rudimentary text edi.pdf
The SIP handles what functionsA.) establishes a call through the .pdf
The NBA decides to look into the use of meldonium in the league foll.pdf
The organelle that serves as the digestive system in the cell is the .pdf
The major type of interactive forces between molecules of NH_3 are .pdf
Ad

Recently uploaded (20)

PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Complications of Minimal Access Surgery at WLH
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
Cell Structure & Organelles in detailed.
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PPTX
Cell Types and Its function , kingdom of life
PPTX
Lesson notes of climatology university.
PDF
RMMM.pdf make it easy to upload and study
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Module 4: Burden of Disease Tutorial Slides S2 2025
O7-L3 Supply Chain Operations - ICLT Program
Complications of Minimal Access Surgery at WLH
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
Cell Structure & Organelles in detailed.
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Microbial diseases, their pathogenesis and prophylaxis
Abdominal Access Techniques with Prof. Dr. R K Mishra
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Final Presentation General Medicine 03-08-2024.pptx
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
Cell Types and Its function , kingdom of life
Lesson notes of climatology university.
RMMM.pdf make it easy to upload and study
Microbial disease of the cardiovascular and lymphatic systems
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
Anesthesia in Laparoscopic Surgery in India
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape

Write a JAVA LinkedListRec class that has the following methods siz.pdf

  • 1. Write a JAVA LinkedListRec class that has the following methods: size, empty, insertBefore, insertAfter, addAtHead, addAtEnd, remove, replace, peekFront, peekEnd, removeFront, removeEnd, toString. Use recursion to implement most of these methods. Write a driver to test your implemented LinkedListRec class methods. Solution import java.util.Scanner; public class LinkedListRec { int data; LinkedListRec prev=null,next=null; int size(LinkedListRec l)//method which returns the length of the list { if(l==null)return 0; return 1+size(l.next); } boolean empty(LinkedListRec l)//method checks whether the list is empty or not... { if(l==null)return true; else return false; } LinkedListRec insertBefore(LinkedListRec l,int value,int num_insertbefore)//method which adds a new number before the given number.. { if(l==null)return l; if(l.data == num_insertbefore) { LinkedListRec n = new LinkedListRec(); n.data = value; if(l.prev==null) { n.next = l; l=n;
  • 2. } else { n.prev = l.prev; n.next= l; l.prev = n; } return l; } return insertBefore(l.next,value,num_insertbefore); } LinkedListRec insertAfter(LinkedListRec l,int value,int num_insertafter)//method which adds the new number after the given number { if(l==null)return l; if(l.data == num_insertafter) { LinkedListRec n = new LinkedListRec(); n.data = value; if(l.next==null) { l.next = n; n.prev = l; } else { n.next = l.next; l.next.prev = n; n.prev = l; } return l; } return insertAfter(l.next,value,num_insertafter);
  • 3. } LinkedListRec addAtHead(LinkedListRec l,int value)//method which adds a new number at the head position of the list... { LinkedListRec n = new LinkedListRec(); n.data=value; n.next = l; l=n; return l; } LinkedListRec addAtEnd(LinkedListRec l,int value)//method which adds a new number at the end position of the list... { if(l==null){ l = new LinkedListRec();l.data = value;return l;} if(l.next==null) { LinkedListRec n = new LinkedListRec(); n.data=value; n.prev = l; l.next = n; return l; } return addAtEnd(l.next,value); } LinkedListRec remove(LinkedListRec l,int value)//method which removes given numbet from the list.... { if(l==null)return l; if(l.data == value) { if(l.prev!=null){ l.prev = l.next; } else l=l.next; return l;
  • 4. } return remove(l.next,value); } boolean replace(LinkedListRec l,int value,int newvalue)//method which replaces current number with new number,... { if(l==null)return false; if(l.data == value) { l.data = newvalue; return true; } return replace(l.next,value,newvalue); } int peekFront(LinkedListRec l)//method which returns the first value of the list... { if(l!=null) return l.data; else return -1; } int peekEnd(LinkedListRec l)//method which returns the last value of the list........ { if(l==null)return -1; if(l.next == null)return l.data; return peekEnd(l.next); } LinkedListRec removeFront(LinkedListRec l)//method which removes the first element of the list.. { if(l==null)return l; l=l.next; return l; } boolean removeEnd(LinkedListRec l)//method which removes the last element of the list// {
  • 5. if(l.next==null) { if(l.prev!=null){l.prev.next=null;return true;} l.data = -1; return true; } return removeEnd(l.next); } String tostring(LinkedListRec l)//displaying list { if(l==null)return ""; System.out.print(l.data+"->"); return l.data+"->"+tostring(l.next); } public static void main(String argv[]) { //driver testing code... LinkedListRec ll = new LinkedListRec(); ll.data = 2; Scanner sc = new Scanner(System.in); int c=-2; while(true) { System.out.println("Select on option(-1 to exit) 1: size of list 2: is list empty 3: insert Before a number 4:insert After a number 5: add At head 6: add at End 7: remove from list 8: Replace a value 9: peekfrontvalue 10:peekendvalue 11:removefrontvalue 12:removeendvalue 13:display"); System.out.print("Enter ur choice"); c = sc.nextInt(); if(c==-1)break; if(c==1){ System.out.println(" Size of List:"+ll.size(ll)); }
  • 6. else if(c==2){ if(ll.empty(ll)) System.out.println(" List is Empty "); else System.out.println(" List is not Empty "); } else if(c==3){ int v,p; System.out.println(" Enter number to insert:"); v = sc.nextInt(); System.out.println(" Enter number to insertBefore it:"); p = sc.nextInt(); ll=ll.insertBefore(ll, v, p); } else if(c==4){ int v,p; System.out.println(" Enter number to insert:"); v = sc.nextInt(); System.out.println(" Enter number to insertAfter it:"); p = sc.nextInt(); ll.insertAfter(ll, v, p); } else if(c==5){ int v; System.out.println(" Enter number to insert:"); v = sc.nextInt(); ll= ll.addAtHead(ll, v); } else if(c==6){ int v; System.out.println(" Enter number to insert:"); v = sc.nextInt(); ll=ll.addAtEnd(ll, v); } else if(c==7){ int v;
  • 7. System.out.println(" Enter number to remove:"); v = sc.nextInt(); ll=ll.remove(ll, v); } else if(c==8){ int v,p; System.out.println(" Enter number to replace:"); v = sc.nextInt(); System.out.println(" Enter which number to replace:"); p = sc.nextInt(); ll.replace(ll, v, p); } else if(c==9){ System.out.println(" Front value of the list:"+ll.peekFront(ll)); } else if(c==10){ System.out.println(" End value of the list:"+ll.peekEnd(ll)); } else if(c==11){ ll=ll.removeFront(ll); System.out.println(" Front value of the list is removed"); } else if(c==12){ if(ll.removeEnd(ll)) { System.out.println(" Front value of the list is removed"); } } else if(c==13){ System.out.println(" The list:"); ll.tostring(ll); System.out.println(); }
  • 8. } } } ouput: run: Select on option(-1 to exit) 1: size of list 2: is list empty 3: insert Before a number 4:insert After a number 5: add At head 6: add at End 7: remove from list 8: Replace a value 9: peekfrontvalue 10:peekendvalue 11:removefrontvalue 12:removeendvalue 13:display Enter ur choice8 Enter number to replace: 2 Enter which number to replace: 7 Select on option(-1 to exit) 1: size of list 2: is list empty 3: insert Before a number 4:insert After a number 5: add At head 6: add at End 7: remove from list 8: Replace a value
  • 9. 9: peekfrontvalue 10:peekendvalue 11:removefrontvalue 12:removeendvalue 13:display Enter ur choice13 The list: 7-> Select on option(-1 to exit) 1: size of list 2: is list empty 3: insert Before a number 4:insert After a number 5: add At head 6: add at End 7: remove from list 8: Replace a value 9: peekfrontvalue 10:peekendvalue 11:removefrontvalue 12:removeendvalue 13:display Enter ur choice9 Front value of the list:7 Select on option(-1 to exit) 1: size of list 2: is list empty 3: insert Before a number 4:insert After a number 5: add At head 6: add at End 7: remove from list 8: Replace a value 9: peekfrontvalue 10:peekendvalue 11:removefrontvalue
  • 10. 12:removeendvalue 13:display Enter ur choice6 Enter number to insert: 9 Select on option(-1 to exit) 1: size of list 2: is list empty 3: insert Before a number 4:insert After a number 5: add At head 6: add at End 7: remove from list 8: Replace a value 9: peekfrontvalue 10:peekendvalue 11:removefrontvalue 12:removeendvalue 13:display Enter ur choice13 The list: 7->9-> Select on option(-1 to exit) 1: size of list 2: is list empty 3: insert Before a number 4:insert After a number 5: add At head 6: add at End 7: remove from list 8: Replace a value 9: peekfrontvalue 10:peekendvalue 11:removefrontvalue 12:removeendvalue 13:display
  • 11. Enter ur choice1 Size of List:2 Select on option(-1 to exit) 1: size of list 2: is list empty 3: insert Before a number 4:insert After a number 5: add At head 6: add at End 7: remove from list 8: Replace a value 9: peekfrontvalue 10:peekendvalue 11:removefrontvalue 12:removeendvalue 13:display Enter ur choice-1