SlideShare a Scribd company logo
Using Java programming language solve the following:
SLL CLASS:
//************************** SLL.java *********************************
// a generic singly linked list class
public class SLL {
private class SLLNode {
private T info;
private SLLNode next;
public SLLNode() {
this(null,null);
}
public SLLNode(T el) {
this(el,null);
}
public SLLNode(T el, SLLNode ptr) {
info = el; next = ptr;
}
}
protected SLLNode head, tail;
public SLL() {
head = tail = null;
}
public boolean isEmpty() {
return head == null;
}
public void addToHead(T el) {
head = new SLLNode(el,head);
if (tail == null)
tail = head;
}
public void addToTail(T el) {
if (!isEmpty()) {
tail.next = new SLLNode(el);
tail = tail.next;
}
else head = tail = new SLLNode(el);
}
public T deleteFromHead() { // delete the head and return its info;
if (isEmpty())
return null;
T el = head.info;
if (head == tail) // if only one node on the list;
head = tail = null;
else head = head.next;
return el;
}
public T deleteFromTail() { // delete the tail and return its info;
if (isEmpty())
return null;
T el = tail.info;
if (head == tail) // if only one node in the list;
head = tail = null;
else { // if more than one node in the list,
SLLNode tmp; // find the predecessor of tail;
for (tmp = head; tmp.next != tail; tmp = tmp.next);
tail = tmp; // the predecessor of tail becomes tail;
tail.next = null;
}
return el;
}
public void delete(T el) { // delete the node with an element el;
if (!isEmpty())
if (head == tail && el.equals(head.info)) // if only one
head = tail = null; // node on the list;
else if (el.equals(head.info)) // if more than one node on the list;
head = head.next; // and el is in the head node;
else { // if more than one node in the list
SLLNode pred, tmp;// and el is in a nonhead node;
for (pred = head, tmp = head.next;
tmp != null && !tmp.info.equals(el);
pred = pred.next, tmp = tmp.next);
if (tmp != null) { // if el was found;
pred.next = tmp.next;
if (tmp == tail) // if el is in the last node;
tail = pred;
}
}
}
@Override
public String toString() {
if(head == null)
return "[ ]";
String str = "[ ";
SLLNode tmp = head;
while(tmp != null){
str += tmp.info + " ";
tmp = tmp.next;
}
return str+"]";
}
public boolean contains(T el) {
if(head == null)
return false;
SLLNode tmp = head;
while(tmp != null){
if(tmp.info.equals(el))
return true;
tmp = tmp.next;
}
return false;
}
public int size(){
if(head == null)
return 0;
int count = 0;
SLLNode p = head;
while(p != null) {
count++;
p = p.next;
}
return count;
}
}
Part I: Programming Use the singly linked list class (Given below) to implement integers of
unlimited size. Each node of the list should store one digit of the integer. You are required to
implement the addition, subtraction and multiplication operations. In addition, provide a test
class that will do the following: It will keep asking the user to enter two integers, choose one of
the operations (addition, subtraction, multiplication) and then display the result. The program
will stop upon entering the "#" character (without the double quotes). Part II: Problem Solving
With respect to the programming problem in Part I , What is the tightest asymptotic running time
for each of your operations, expressed in terms of the number of digits for the two operands, m
and n, of each operation? Clearly justify your answer.

More Related Content

Similar to Using Java programming language solve the followingSLL CLASS.pdf

Please finish the int LLInsert function.typedef struct STUDENT {.pdf
Please finish the int LLInsert function.typedef struct STUDENT {.pdfPlease finish the int LLInsert function.typedef struct STUDENT {.pdf
Please finish the int LLInsert function.typedef struct STUDENT {.pdf
fortmdu
 
mainpublic class AssignmentThree {    public static void ma.pdf
mainpublic class AssignmentThree {    public static void ma.pdfmainpublic class AssignmentThree {    public static void ma.pdf
mainpublic class AssignmentThree {    public static void ma.pdf
fathimafancyjeweller
 
Linked lists
Linked listsLinked lists
Linked lists
George Scott IV
 
Table.java Huffman code frequency tableimport java.io.;im.docx
 Table.java Huffman code frequency tableimport java.io.;im.docx Table.java Huffman code frequency tableimport java.io.;im.docx
Table.java Huffman code frequency tableimport java.io.;im.docx
MARRY7
 
C Programming Homework Help
C Programming Homework HelpC Programming Homework Help
C Programming Homework Help
Programming Homework Help
 
Solutionclass IntNode { int data; public IntNode next,head;.pdf
Solutionclass IntNode { int data; public IntNode next,head;.pdfSolutionclass IntNode { int data; public IntNode next,head;.pdf
Solutionclass IntNode { int data; public IntNode next,head;.pdf
rakeshankur
 
fix the error - class Node{ int data- Node next-.pdf
fix the error -   class Node{           int data-           Node next-.pdffix the error -   class Node{           int data-           Node next-.pdf
fix the error - class Node{ int data- Node next-.pdf
AKVIGFOEU
 
Features of Kotlin I find exciting
Features of Kotlin I find excitingFeatures of Kotlin I find exciting
Features of Kotlin I find exciting
Robert MacLean
 
Scala vs Java 8 in a Java 8 World
Scala vs Java 8 in a Java 8 WorldScala vs Java 8 in a Java 8 World
Scala vs Java 8 in a Java 8 World
BTI360
 
DS Code (CWH).docx
DS Code (CWH).docxDS Code (CWH).docx
DS Code (CWH).docx
KamalSaini561034
 
how do i expand upon selectionSortType so that you are no longer bou.pdf
how do i expand upon selectionSortType so that you are no longer bou.pdfhow do i expand upon selectionSortType so that you are no longer bou.pdf
how do i expand upon selectionSortType so that you are no longer bou.pdf
footwearpark
 
#include sstream #include linkylist.h #include iostream.pdf
#include sstream #include linkylist.h #include iostream.pdf#include sstream #include linkylist.h #include iostream.pdf
#include sstream #include linkylist.h #include iostream.pdf
aravlitraders2012
 
Rewrite this code so it can use a generic type instead of integers. .pdf
Rewrite this code so it can use a generic type instead of integers. .pdfRewrite this code so it can use a generic type instead of integers. .pdf
Rewrite this code so it can use a generic type instead of integers. .pdf
alphaagenciesindia
 
tested on eclipseDoublyLinkedList class.pdf
tested on eclipseDoublyLinkedList class.pdftested on eclipseDoublyLinkedList class.pdf
tested on eclipseDoublyLinkedList class.pdf
shanki7
 
^^^ Discuss about Header Node And also write a program for unorder.pdf
^^^ Discuss about Header Node  And also write a program for unorder.pdf^^^ Discuss about Header Node  And also write a program for unorder.pdf
^^^ Discuss about Header Node And also write a program for unorder.pdf
arihantmum
 
You can list anything, it doesnt matter. I just want to see code f.pdf
You can list anything, it doesnt matter. I just want to see code f.pdfYou can list anything, it doesnt matter. I just want to see code f.pdf
You can list anything, it doesnt matter. I just want to see code f.pdf
fashionbigchennai
 
Linked Stack program.docx
Linked Stack program.docxLinked Stack program.docx
Linked Stack program.docx
kudikalakalabharathi
 
Discuss about Header Node And also write a program for unordered si.pdf
Discuss about Header Node  And also write a program for unordered si.pdfDiscuss about Header Node  And also write a program for unordered si.pdf
Discuss about Header Node And also write a program for unordered si.pdf
eyevision3
 
So I have this code(StackInAllSocks) and I implemented the method but.pdf
So I have this code(StackInAllSocks) and I implemented the method but.pdfSo I have this code(StackInAllSocks) and I implemented the method but.pdf
So I have this code(StackInAllSocks) and I implemented the method but.pdf
aksahnan
 

Similar to Using Java programming language solve the followingSLL CLASS.pdf (20)

Please finish the int LLInsert function.typedef struct STUDENT {.pdf
Please finish the int LLInsert function.typedef struct STUDENT {.pdfPlease finish the int LLInsert function.typedef struct STUDENT {.pdf
Please finish the int LLInsert function.typedef struct STUDENT {.pdf
 
mainpublic class AssignmentThree {    public static void ma.pdf
mainpublic class AssignmentThree {    public static void ma.pdfmainpublic class AssignmentThree {    public static void ma.pdf
mainpublic class AssignmentThree {    public static void ma.pdf
 
Linked lists
Linked listsLinked lists
Linked lists
 
Table.java Huffman code frequency tableimport java.io.;im.docx
 Table.java Huffman code frequency tableimport java.io.;im.docx Table.java Huffman code frequency tableimport java.io.;im.docx
Table.java Huffman code frequency tableimport java.io.;im.docx
 
C Programming Homework Help
C Programming Homework HelpC Programming Homework Help
C Programming Homework Help
 
Solutionclass IntNode { int data; public IntNode next,head;.pdf
Solutionclass IntNode { int data; public IntNode next,head;.pdfSolutionclass IntNode { int data; public IntNode next,head;.pdf
Solutionclass IntNode { int data; public IntNode next,head;.pdf
 
fix the error - class Node{ int data- Node next-.pdf
fix the error -   class Node{           int data-           Node next-.pdffix the error -   class Node{           int data-           Node next-.pdf
fix the error - class Node{ int data- Node next-.pdf
 
Features of Kotlin I find exciting
Features of Kotlin I find excitingFeatures of Kotlin I find exciting
Features of Kotlin I find exciting
 
Scala vs Java 8 in a Java 8 World
Scala vs Java 8 in a Java 8 WorldScala vs Java 8 in a Java 8 World
Scala vs Java 8 in a Java 8 World
 
DS Code (CWH).docx
DS Code (CWH).docxDS Code (CWH).docx
DS Code (CWH).docx
 
how do i expand upon selectionSortType so that you are no longer bou.pdf
how do i expand upon selectionSortType so that you are no longer bou.pdfhow do i expand upon selectionSortType so that you are no longer bou.pdf
how do i expand upon selectionSortType so that you are no longer bou.pdf
 
#include sstream #include linkylist.h #include iostream.pdf
#include sstream #include linkylist.h #include iostream.pdf#include sstream #include linkylist.h #include iostream.pdf
#include sstream #include linkylist.h #include iostream.pdf
 
Rewrite this code so it can use a generic type instead of integers. .pdf
Rewrite this code so it can use a generic type instead of integers. .pdfRewrite this code so it can use a generic type instead of integers. .pdf
Rewrite this code so it can use a generic type instead of integers. .pdf
 
tested on eclipseDoublyLinkedList class.pdf
tested on eclipseDoublyLinkedList class.pdftested on eclipseDoublyLinkedList class.pdf
tested on eclipseDoublyLinkedList class.pdf
 
^^^ Discuss about Header Node And also write a program for unorder.pdf
^^^ Discuss about Header Node  And also write a program for unorder.pdf^^^ Discuss about Header Node  And also write a program for unorder.pdf
^^^ Discuss about Header Node And also write a program for unorder.pdf
 
You can list anything, it doesnt matter. I just want to see code f.pdf
You can list anything, it doesnt matter. I just want to see code f.pdfYou can list anything, it doesnt matter. I just want to see code f.pdf
You can list anything, it doesnt matter. I just want to see code f.pdf
 
Linked Stack program.docx
Linked Stack program.docxLinked Stack program.docx
Linked Stack program.docx
 
Discuss about Header Node And also write a program for unordered si.pdf
Discuss about Header Node  And also write a program for unordered si.pdfDiscuss about Header Node  And also write a program for unordered si.pdf
Discuss about Header Node And also write a program for unordered si.pdf
 
137 Lab-2.2.pdf
137 Lab-2.2.pdf137 Lab-2.2.pdf
137 Lab-2.2.pdf
 
So I have this code(StackInAllSocks) and I implemented the method but.pdf
So I have this code(StackInAllSocks) and I implemented the method but.pdfSo I have this code(StackInAllSocks) and I implemented the method but.pdf
So I have this code(StackInAllSocks) and I implemented the method but.pdf
 

More from adonisjpr

Una mujer de 36 a�os que se someti� a un trasplante de ri��n hace 2 .pdf
Una mujer de 36 a�os que se someti� a un trasplante de ri��n hace 2 .pdfUna mujer de 36 a�os que se someti� a un trasplante de ri��n hace 2 .pdf
Una mujer de 36 a�os que se someti� a un trasplante de ri��n hace 2 .pdf
adonisjpr
 
Una empresa tiene un ciclo operativo de 120 d�as, un per�odo promedi.pdf
Una empresa tiene un ciclo operativo de 120 d�as, un per�odo promedi.pdfUna empresa tiene un ciclo operativo de 120 d�as, un per�odo promedi.pdf
Una empresa tiene un ciclo operativo de 120 d�as, un per�odo promedi.pdf
adonisjpr
 
Una empresa pag� por �ltima vez un dividendo de �3. Si el rendimient.pdf
Una empresa pag� por �ltima vez un dividendo de �3. Si el rendimient.pdfUna empresa pag� por �ltima vez un dividendo de �3. Si el rendimient.pdf
Una empresa pag� por �ltima vez un dividendo de �3. Si el rendimient.pdf
adonisjpr
 
Una cartera eficiente es una combinaci�n de activos que 0 1 pun.pdf
Una cartera eficiente es una combinaci�n de activos que 0  1 pun.pdfUna cartera eficiente es una combinaci�n de activos que 0  1 pun.pdf
Una cartera eficiente es una combinaci�n de activos que 0 1 pun.pdf
adonisjpr
 
Un objetivo a corto plazo esOpci�n multiple A) una meta espec.pdf
Un objetivo a corto plazo esOpci�n multiple A) una meta espec.pdfUn objetivo a corto plazo esOpci�n multiple A) una meta espec.pdf
Un objetivo a corto plazo esOpci�n multiple A) una meta espec.pdf
adonisjpr
 
Tyco International, una empresa de fabricaci�n, demand� a su ex dire.pdf
Tyco International, una empresa de fabricaci�n, demand� a su ex dire.pdfTyco International, una empresa de fabricaci�n, demand� a su ex dire.pdf
Tyco International, una empresa de fabricaci�n, demand� a su ex dire.pdf
adonisjpr
 
Un informe de an�lisis de estados financieros no incluye A) una dec.pdf
Un informe de an�lisis de estados financieros no incluye A) una dec.pdfUn informe de an�lisis de estados financieros no incluye A) una dec.pdf
Un informe de an�lisis de estados financieros no incluye A) una dec.pdf
adonisjpr
 
ubat 2015te Hazine 4 78lik 2044 alt aylk bileik vadeye kadar 2,8.pdf
ubat 2015te Hazine 4 78lik 2044 alt aylk bileik vadeye kadar 2,8.pdfubat 2015te Hazine 4 78lik 2044 alt aylk bileik vadeye kadar 2,8.pdf
ubat 2015te Hazine 4 78lik 2044 alt aylk bileik vadeye kadar 2,8.pdf
adonisjpr
 
Two categories of attackers include hacktivists and state actors. .pdf
Two categories of attackers include hacktivists and state actors. .pdfTwo categories of attackers include hacktivists and state actors. .pdf
Two categories of attackers include hacktivists and state actors. .pdf
adonisjpr
 
Twitter, el popular sitio de microblogs, se ha enfrentado a graves c.pdf
Twitter, el popular sitio de microblogs, se ha enfrentado a graves c.pdfTwitter, el popular sitio de microblogs, se ha enfrentado a graves c.pdf
Twitter, el popular sitio de microblogs, se ha enfrentado a graves c.pdf
adonisjpr
 
Turner, Roth y Lowe son socios que comparten ingresos y p�rdidas en .pdf
Turner, Roth y Lowe son socios que comparten ingresos y p�rdidas en .pdfTurner, Roth y Lowe son socios que comparten ingresos y p�rdidas en .pdf
Turner, Roth y Lowe son socios que comparten ingresos y p�rdidas en .pdf
adonisjpr
 
Uber - Bir Startupn K�kenleri ve lk G�nleriDava M�terileri ele.pdf
Uber - Bir Startupn K�kenleri ve lk G�nleriDava M�terileri ele.pdfUber - Bir Startupn K�kenleri ve lk G�nleriDava M�terileri ele.pdf
Uber - Bir Startupn K�kenleri ve lk G�nleriDava M�terileri ele.pdf
adonisjpr
 
Trilogy Enterprises Inc. de Austin, Texas, es una empresa de softwar.pdf
Trilogy Enterprises Inc. de Austin, Texas, es una empresa de softwar.pdfTrilogy Enterprises Inc. de Austin, Texas, es una empresa de softwar.pdf
Trilogy Enterprises Inc. de Austin, Texas, es una empresa de softwar.pdf
adonisjpr
 
Transforming Data - Creating a Data Set Creating a JOIN between two .pdf
Transforming Data - Creating a Data Set Creating a JOIN between two .pdfTransforming Data - Creating a Data Set Creating a JOIN between two .pdf
Transforming Data - Creating a Data Set Creating a JOIN between two .pdf
adonisjpr
 
Using the location quotients(LQ) for year 2020 for 10 provinces anal.pdf
Using the location quotients(LQ) for year 2020 for 10 provinces anal.pdfUsing the location quotients(LQ) for year 2020 for 10 provinces anal.pdf
Using the location quotients(LQ) for year 2020 for 10 provinces anal.pdf
adonisjpr
 
Using the packet tracer simulator, create a network topology that in.pdf
Using the packet tracer simulator, create a network topology that in.pdfUsing the packet tracer simulator, create a network topology that in.pdf
Using the packet tracer simulator, create a network topology that in.pdf
adonisjpr
 
using silde 2 to answer silde 1 and 3 Step 17 of 40 - Create T Accou.pdf
using silde 2 to answer silde 1 and 3 Step 17 of 40 - Create T Accou.pdfusing silde 2 to answer silde 1 and 3 Step 17 of 40 - Create T Accou.pdf
using silde 2 to answer silde 1 and 3 Step 17 of 40 - Create T Accou.pdf
adonisjpr
 
Using financial data and information from Yahoo Finance only, calcul.pdf
Using financial data and information from Yahoo Finance only, calcul.pdfUsing financial data and information from Yahoo Finance only, calcul.pdf
Using financial data and information from Yahoo Finance only, calcul.pdf
adonisjpr
 
using IRAC method Joseph was a team manager of an excursion in the O.pdf
using IRAC method Joseph was a team manager of an excursion in the O.pdfusing IRAC method Joseph was a team manager of an excursion in the O.pdf
using IRAC method Joseph was a team manager of an excursion in the O.pdf
adonisjpr
 
using IRAC method Mary is an explorer and is about to set off on a.pdf
using IRAC method Mary is an explorer and is about to set off on a.pdfusing IRAC method Mary is an explorer and is about to set off on a.pdf
using IRAC method Mary is an explorer and is about to set off on a.pdf
adonisjpr
 

More from adonisjpr (20)

Una mujer de 36 a�os que se someti� a un trasplante de ri��n hace 2 .pdf
Una mujer de 36 a�os que se someti� a un trasplante de ri��n hace 2 .pdfUna mujer de 36 a�os que se someti� a un trasplante de ri��n hace 2 .pdf
Una mujer de 36 a�os que se someti� a un trasplante de ri��n hace 2 .pdf
 
Una empresa tiene un ciclo operativo de 120 d�as, un per�odo promedi.pdf
Una empresa tiene un ciclo operativo de 120 d�as, un per�odo promedi.pdfUna empresa tiene un ciclo operativo de 120 d�as, un per�odo promedi.pdf
Una empresa tiene un ciclo operativo de 120 d�as, un per�odo promedi.pdf
 
Una empresa pag� por �ltima vez un dividendo de �3. Si el rendimient.pdf
Una empresa pag� por �ltima vez un dividendo de �3. Si el rendimient.pdfUna empresa pag� por �ltima vez un dividendo de �3. Si el rendimient.pdf
Una empresa pag� por �ltima vez un dividendo de �3. Si el rendimient.pdf
 
Una cartera eficiente es una combinaci�n de activos que 0 1 pun.pdf
Una cartera eficiente es una combinaci�n de activos que 0  1 pun.pdfUna cartera eficiente es una combinaci�n de activos que 0  1 pun.pdf
Una cartera eficiente es una combinaci�n de activos que 0 1 pun.pdf
 
Un objetivo a corto plazo esOpci�n multiple A) una meta espec.pdf
Un objetivo a corto plazo esOpci�n multiple A) una meta espec.pdfUn objetivo a corto plazo esOpci�n multiple A) una meta espec.pdf
Un objetivo a corto plazo esOpci�n multiple A) una meta espec.pdf
 
Tyco International, una empresa de fabricaci�n, demand� a su ex dire.pdf
Tyco International, una empresa de fabricaci�n, demand� a su ex dire.pdfTyco International, una empresa de fabricaci�n, demand� a su ex dire.pdf
Tyco International, una empresa de fabricaci�n, demand� a su ex dire.pdf
 
Un informe de an�lisis de estados financieros no incluye A) una dec.pdf
Un informe de an�lisis de estados financieros no incluye A) una dec.pdfUn informe de an�lisis de estados financieros no incluye A) una dec.pdf
Un informe de an�lisis de estados financieros no incluye A) una dec.pdf
 
ubat 2015te Hazine 4 78lik 2044 alt aylk bileik vadeye kadar 2,8.pdf
ubat 2015te Hazine 4 78lik 2044 alt aylk bileik vadeye kadar 2,8.pdfubat 2015te Hazine 4 78lik 2044 alt aylk bileik vadeye kadar 2,8.pdf
ubat 2015te Hazine 4 78lik 2044 alt aylk bileik vadeye kadar 2,8.pdf
 
Two categories of attackers include hacktivists and state actors. .pdf
Two categories of attackers include hacktivists and state actors. .pdfTwo categories of attackers include hacktivists and state actors. .pdf
Two categories of attackers include hacktivists and state actors. .pdf
 
Twitter, el popular sitio de microblogs, se ha enfrentado a graves c.pdf
Twitter, el popular sitio de microblogs, se ha enfrentado a graves c.pdfTwitter, el popular sitio de microblogs, se ha enfrentado a graves c.pdf
Twitter, el popular sitio de microblogs, se ha enfrentado a graves c.pdf
 
Turner, Roth y Lowe son socios que comparten ingresos y p�rdidas en .pdf
Turner, Roth y Lowe son socios que comparten ingresos y p�rdidas en .pdfTurner, Roth y Lowe son socios que comparten ingresos y p�rdidas en .pdf
Turner, Roth y Lowe son socios que comparten ingresos y p�rdidas en .pdf
 
Uber - Bir Startupn K�kenleri ve lk G�nleriDava M�terileri ele.pdf
Uber - Bir Startupn K�kenleri ve lk G�nleriDava M�terileri ele.pdfUber - Bir Startupn K�kenleri ve lk G�nleriDava M�terileri ele.pdf
Uber - Bir Startupn K�kenleri ve lk G�nleriDava M�terileri ele.pdf
 
Trilogy Enterprises Inc. de Austin, Texas, es una empresa de softwar.pdf
Trilogy Enterprises Inc. de Austin, Texas, es una empresa de softwar.pdfTrilogy Enterprises Inc. de Austin, Texas, es una empresa de softwar.pdf
Trilogy Enterprises Inc. de Austin, Texas, es una empresa de softwar.pdf
 
Transforming Data - Creating a Data Set Creating a JOIN between two .pdf
Transforming Data - Creating a Data Set Creating a JOIN between two .pdfTransforming Data - Creating a Data Set Creating a JOIN between two .pdf
Transforming Data - Creating a Data Set Creating a JOIN between two .pdf
 
Using the location quotients(LQ) for year 2020 for 10 provinces anal.pdf
Using the location quotients(LQ) for year 2020 for 10 provinces anal.pdfUsing the location quotients(LQ) for year 2020 for 10 provinces anal.pdf
Using the location quotients(LQ) for year 2020 for 10 provinces anal.pdf
 
Using the packet tracer simulator, create a network topology that in.pdf
Using the packet tracer simulator, create a network topology that in.pdfUsing the packet tracer simulator, create a network topology that in.pdf
Using the packet tracer simulator, create a network topology that in.pdf
 
using silde 2 to answer silde 1 and 3 Step 17 of 40 - Create T Accou.pdf
using silde 2 to answer silde 1 and 3 Step 17 of 40 - Create T Accou.pdfusing silde 2 to answer silde 1 and 3 Step 17 of 40 - Create T Accou.pdf
using silde 2 to answer silde 1 and 3 Step 17 of 40 - Create T Accou.pdf
 
Using financial data and information from Yahoo Finance only, calcul.pdf
Using financial data and information from Yahoo Finance only, calcul.pdfUsing financial data and information from Yahoo Finance only, calcul.pdf
Using financial data and information from Yahoo Finance only, calcul.pdf
 
using IRAC method Joseph was a team manager of an excursion in the O.pdf
using IRAC method Joseph was a team manager of an excursion in the O.pdfusing IRAC method Joseph was a team manager of an excursion in the O.pdf
using IRAC method Joseph was a team manager of an excursion in the O.pdf
 
using IRAC method Mary is an explorer and is about to set off on a.pdf
using IRAC method Mary is an explorer and is about to set off on a.pdfusing IRAC method Mary is an explorer and is about to set off on a.pdf
using IRAC method Mary is an explorer and is about to set off on a.pdf
 

Recently uploaded

Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
chanes7
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
gb193092
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 

Recently uploaded (20)

Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 

Using Java programming language solve the followingSLL CLASS.pdf

  • 1. Using Java programming language solve the following: SLL CLASS: //************************** SLL.java ********************************* // a generic singly linked list class public class SLL { private class SLLNode { private T info; private SLLNode next; public SLLNode() { this(null,null); } public SLLNode(T el) { this(el,null); } public SLLNode(T el, SLLNode ptr) { info = el; next = ptr; } } protected SLLNode head, tail; public SLL() { head = tail = null; } public boolean isEmpty() { return head == null; } public void addToHead(T el) { head = new SLLNode(el,head); if (tail == null) tail = head;
  • 2. } public void addToTail(T el) { if (!isEmpty()) { tail.next = new SLLNode(el); tail = tail.next; } else head = tail = new SLLNode(el); } public T deleteFromHead() { // delete the head and return its info; if (isEmpty()) return null; T el = head.info; if (head == tail) // if only one node on the list; head = tail = null; else head = head.next; return el; } public T deleteFromTail() { // delete the tail and return its info; if (isEmpty()) return null; T el = tail.info; if (head == tail) // if only one node in the list; head = tail = null; else { // if more than one node in the list, SLLNode tmp; // find the predecessor of tail; for (tmp = head; tmp.next != tail; tmp = tmp.next); tail = tmp; // the predecessor of tail becomes tail; tail.next = null; } return el; } public void delete(T el) { // delete the node with an element el; if (!isEmpty()) if (head == tail && el.equals(head.info)) // if only one head = tail = null; // node on the list; else if (el.equals(head.info)) // if more than one node on the list;
  • 3. head = head.next; // and el is in the head node; else { // if more than one node in the list SLLNode pred, tmp;// and el is in a nonhead node; for (pred = head, tmp = head.next; tmp != null && !tmp.info.equals(el); pred = pred.next, tmp = tmp.next); if (tmp != null) { // if el was found; pred.next = tmp.next; if (tmp == tail) // if el is in the last node; tail = pred; } } } @Override public String toString() { if(head == null) return "[ ]"; String str = "[ "; SLLNode tmp = head; while(tmp != null){ str += tmp.info + " "; tmp = tmp.next; } return str+"]"; } public boolean contains(T el) { if(head == null) return false; SLLNode tmp = head; while(tmp != null){ if(tmp.info.equals(el)) return true;
  • 4. tmp = tmp.next; } return false; } public int size(){ if(head == null) return 0; int count = 0; SLLNode p = head; while(p != null) { count++; p = p.next; } return count; } } Part I: Programming Use the singly linked list class (Given below) to implement integers of unlimited size. Each node of the list should store one digit of the integer. You are required to implement the addition, subtraction and multiplication operations. In addition, provide a test class that will do the following: It will keep asking the user to enter two integers, choose one of the operations (addition, subtraction, multiplication) and then display the result. The program will stop upon entering the "#" character (without the double quotes). Part II: Problem Solving With respect to the programming problem in Part I , What is the tightest asymptotic running time for each of your operations, expressed in terms of the number of digits for the two operands, m and n, of each operation? Clearly justify your answer.