SlideShare a Scribd company logo
1 of 4
Download to read offline
here is the starter code:
public class LinkedListPracticeLab {
private LinkedListPracticeLab(){}
public static void main(String[] args) {
// Test all methods here
}
/**
* Given the heads of two sorted linked lists, merges the two lists in a one
sorted list.
* The list is made by splicing together the nodes of the original two lists,
without
* creating any new nodes.
*
* Returns the head of the merged linked list.
*/
public static ListNode mergeLists(ListNode head1, ListNode head2) {
return null;
}
/**
* Given the head of a sorted linked list, deletes all duplicates such that
each element appears only once.
*
* Returns the head of the resulting linked list, which is still sorted.
*/
public static ListNode deleteDuplicates(ListNode head) {
return null;
}
/**
* Given the head of a linked list and an integer val, removes all the nodes of
the linked list that has
* Node.val == val.
*
* Returns the head of the resulting list.
*/
public static ListNode removeElements(ListNode head, int val) {
return null;
}
/**
* Given the head of a zero-indexed linked list and two indices i and j, swaps
the elements at these indices.
*
* Returns the head of the resulting list.
*/
public static ListNode swapElements(ListNode head, int i, int j) {
return null;
}
/**
* Given the head of a singly linked list, reverse the list, and return the
reversed list.
*/
public static ListNode reverseList(ListNode head) {
return null;
}
/**
* Given the head of a singly linked list, returns the middle node of the
linked list.
*
* If there are an even number of elements -- and thus two middle nodes --
returns the second middle node.
*/
public static ListNode middleNode(ListNode head) {
return null;
}
}
list node.java code:
/**
* Definition for singly-linked list.
*/
public class ListNode {
int val;
ListNode next;
ListNode() {}
ListNode(int val) { this.val = val; }
ListNode(int val, ListNode next) { this.val = val; this.next = next; }
}
List utils.java code
/**
* Utilities for singly-linked non-circular lists.
*/
public class ListUtils {
private ListUtils() {}
static ListNode copyList(ListNode list) {
ListNode head = new ListNode(list.val);
ListNode currentNew = head;
ListNode currentOld = list.next;
while(currentOld != null) {
currentNew.next = new ListNode(currentOld.val);
currentNew = currentNew.next;
currentOld = currentOld.next;
}
return head;
}
static void displayList(ListNode list) {
if(list == null) {
System.out.println("[]");
return;
}
StringBuilder sb = new StringBuilder();
sb.append('[');
while(list != null) {
sb.append(list.val);
sb.append(',');
sb.append(' ');
list = list.next;
}
sb.delete(sb.lastIndexOf(","), sb.length());
sb.append(']');
System.out.println(sb);
}
static ListNode arrayToLinkedList(int[] arr) {
if(arr.length == 0)
return null;
ListNode head = new ListNode(arr[0]);
ListNode current = head;
for(int i = 1; i < arr.length; i++) {
current.next = new ListNode(arr[i]);
current = current.next;
}
return head;
}
}
For this lab you will solve a few separate problems that involve linked lists. Some of these
problems are taken from leetcode, but in a few instances are made small changes. TASK 1
display linked lists. TASK 2 Download this starter code: LinkedListPracticeLab.java you are trying
to solve! And when designing your solution you may want to make some drawings of how the
linked lists are being manipulated. TASK 3 the tests. But make sure you include several tests for
each solution, and that you test for "special" or "boundary" cases. Submit: Your version of
LinkedListPracticeLab.java. For each implemented method, a screenshot showing tests for that
method.

More Related Content

Similar to here is the starter code public class LinkedListPracticeLab.pdf

Lec-4_Linked-List (1).pdf
Lec-4_Linked-List (1).pdfLec-4_Linked-List (1).pdf
Lec-4_Linked-List (1).pdfKylaMaeGarcia1
 
STAGE 2 The Methods 65 points Implement all the methods t.pdf
STAGE 2 The Methods 65 points Implement all the methods t.pdfSTAGE 2 The Methods 65 points Implement all the methods t.pdf
STAGE 2 The Methods 65 points Implement all the methods t.pdfbabitasingh698417
 
using the single linked list code written in the class or in the lab,.pdf
using the single linked list code written in the class or in the lab,.pdfusing the single linked list code written in the class or in the lab,.pdf
using the single linked list code written in the class or in the lab,.pdfRBMADU
 
Javai have to make a method that takes a linked list and then retu.pdf
Javai have to make a method that takes a linked list and then retu.pdfJavai have to make a method that takes a linked list and then retu.pdf
Javai have to make a method that takes a linked list and then retu.pdfstopgolook
 
Data Structures in C++I am really new to C++, so links are really .pdf
Data Structures in C++I am really new to C++, so links are really .pdfData Structures in C++I am really new to C++, so links are really .pdf
Data Structures in C++I am really new to C++, so links are really .pdfrohit219406
 
File LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdfFile LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdfConint29
 
Lecture 18Dynamic Data Structures and Generics (II).docx
Lecture 18Dynamic Data Structures and Generics (II).docxLecture 18Dynamic Data Structures and Generics (II).docx
Lecture 18Dynamic Data Structures and Generics (II).docxSHIVA101531
 
LabProgram.javaimport java.util.NoSuchElementException;public .pdf
LabProgram.javaimport java.util.NoSuchElementException;public .pdfLabProgram.javaimport java.util.NoSuchElementException;public .pdf
LabProgram.javaimport java.util.NoSuchElementException;public .pdffantasiatheoutofthef
 
public class ThreeTenDLList-T- implements Iterable-T- { -- doubly.docx
public class ThreeTenDLList-T- implements Iterable-T- {      -- doubly.docxpublic class ThreeTenDLList-T- implements Iterable-T- {      -- doubly.docx
public class ThreeTenDLList-T- implements Iterable-T- { -- doubly.docxLukeQVdGrantg
 
Hi,I have added the methods and main class as per your requirement.pdf
Hi,I have added the methods and main class as per your requirement.pdfHi,I have added the methods and main class as per your requirement.pdf
Hi,I have added the methods and main class as per your requirement.pdfannaelctronics
 
write on this code A Sentinel List has two special n.pdf
write on this code    A Sentinel List has two special n.pdfwrite on this code    A Sentinel List has two special n.pdf
write on this code A Sentinel List has two special n.pdfabifancystore
 
Csphtp1 23
Csphtp1 23Csphtp1 23
Csphtp1 23HUST
 
Csphtp1 23
Csphtp1 23Csphtp1 23
Csphtp1 23HUST
 
Below is a depiction of a doubly-linked list implementation of the bag.docx
Below is a depiction of a doubly-linked list implementation of the bag.docxBelow is a depiction of a doubly-linked list implementation of the bag.docx
Below is a depiction of a doubly-linked list implementation of the bag.docxgilliandunce53776
 
Please complete all the code as per instructions in Java programming.docx
Please complete all the code as per instructions in Java programming.docxPlease complete all the code as per instructions in Java programming.docx
Please complete all the code as per instructions in Java programming.docxcgraciela1
 
Dividing a linked list into two sublists of almost equal sizesa. A.pdf
Dividing a linked list into two sublists of almost equal sizesa. A.pdfDividing a linked list into two sublists of almost equal sizesa. A.pdf
Dividing a linked list into two sublists of almost equal sizesa. A.pdftesmondday29076
 
linked List.docx vhjgvjhvgjhjhbbjkhkjhkjh
linked List.docx vhjgvjhvgjhjhbbjkhkjhkjhlinked List.docx vhjgvjhvgjhjhbbjkhkjhkjh
linked List.docx vhjgvjhvgjhjhbbjkhkjhkjhvasavim9
 
This assignment and the next (#5) involve design and development of a.pdf
This assignment and the next (#5) involve design and development of a.pdfThis assignment and the next (#5) involve design and development of a.pdf
This assignment and the next (#5) involve design and development of a.pdfEricvtJFraserr
 
public class MyLinkedListltE extends ComparableltEgtg.pdf
public class MyLinkedListltE extends ComparableltEgtg.pdfpublic class MyLinkedListltE extends ComparableltEgtg.pdf
public class MyLinkedListltE extends ComparableltEgtg.pdfaccostinternational
 
How to do insertion sort on a singly linked list with no header usin.pdf
How to do insertion sort on a singly linked list with no header usin.pdfHow to do insertion sort on a singly linked list with no header usin.pdf
How to do insertion sort on a singly linked list with no header usin.pdfarihantelehyb
 

Similar to here is the starter code public class LinkedListPracticeLab.pdf (20)

Lec-4_Linked-List (1).pdf
Lec-4_Linked-List (1).pdfLec-4_Linked-List (1).pdf
Lec-4_Linked-List (1).pdf
 
STAGE 2 The Methods 65 points Implement all the methods t.pdf
STAGE 2 The Methods 65 points Implement all the methods t.pdfSTAGE 2 The Methods 65 points Implement all the methods t.pdf
STAGE 2 The Methods 65 points Implement all the methods t.pdf
 
using the single linked list code written in the class or in the lab,.pdf
using the single linked list code written in the class or in the lab,.pdfusing the single linked list code written in the class or in the lab,.pdf
using the single linked list code written in the class or in the lab,.pdf
 
Javai have to make a method that takes a linked list and then retu.pdf
Javai have to make a method that takes a linked list and then retu.pdfJavai have to make a method that takes a linked list and then retu.pdf
Javai have to make a method that takes a linked list and then retu.pdf
 
Data Structures in C++I am really new to C++, so links are really .pdf
Data Structures in C++I am really new to C++, so links are really .pdfData Structures in C++I am really new to C++, so links are really .pdf
Data Structures in C++I am really new to C++, so links are really .pdf
 
File LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdfFile LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdf
 
Lecture 18Dynamic Data Structures and Generics (II).docx
Lecture 18Dynamic Data Structures and Generics (II).docxLecture 18Dynamic Data Structures and Generics (II).docx
Lecture 18Dynamic Data Structures and Generics (II).docx
 
LabProgram.javaimport java.util.NoSuchElementException;public .pdf
LabProgram.javaimport java.util.NoSuchElementException;public .pdfLabProgram.javaimport java.util.NoSuchElementException;public .pdf
LabProgram.javaimport java.util.NoSuchElementException;public .pdf
 
public class ThreeTenDLList-T- implements Iterable-T- { -- doubly.docx
public class ThreeTenDLList-T- implements Iterable-T- {      -- doubly.docxpublic class ThreeTenDLList-T- implements Iterable-T- {      -- doubly.docx
public class ThreeTenDLList-T- implements Iterable-T- { -- doubly.docx
 
Hi,I have added the methods and main class as per your requirement.pdf
Hi,I have added the methods and main class as per your requirement.pdfHi,I have added the methods and main class as per your requirement.pdf
Hi,I have added the methods and main class as per your requirement.pdf
 
write on this code A Sentinel List has two special n.pdf
write on this code    A Sentinel List has two special n.pdfwrite on this code    A Sentinel List has two special n.pdf
write on this code A Sentinel List has two special n.pdf
 
Csphtp1 23
Csphtp1 23Csphtp1 23
Csphtp1 23
 
Csphtp1 23
Csphtp1 23Csphtp1 23
Csphtp1 23
 
Below is a depiction of a doubly-linked list implementation of the bag.docx
Below is a depiction of a doubly-linked list implementation of the bag.docxBelow is a depiction of a doubly-linked list implementation of the bag.docx
Below is a depiction of a doubly-linked list implementation of the bag.docx
 
Please complete all the code as per instructions in Java programming.docx
Please complete all the code as per instructions in Java programming.docxPlease complete all the code as per instructions in Java programming.docx
Please complete all the code as per instructions in Java programming.docx
 
Dividing a linked list into two sublists of almost equal sizesa. A.pdf
Dividing a linked list into two sublists of almost equal sizesa. A.pdfDividing a linked list into two sublists of almost equal sizesa. A.pdf
Dividing a linked list into two sublists of almost equal sizesa. A.pdf
 
linked List.docx vhjgvjhvgjhjhbbjkhkjhkjh
linked List.docx vhjgvjhvgjhjhbbjkhkjhkjhlinked List.docx vhjgvjhvgjhjhbbjkhkjhkjh
linked List.docx vhjgvjhvgjhjhbbjkhkjhkjh
 
This assignment and the next (#5) involve design and development of a.pdf
This assignment and the next (#5) involve design and development of a.pdfThis assignment and the next (#5) involve design and development of a.pdf
This assignment and the next (#5) involve design and development of a.pdf
 
public class MyLinkedListltE extends ComparableltEgtg.pdf
public class MyLinkedListltE extends ComparableltEgtg.pdfpublic class MyLinkedListltE extends ComparableltEgtg.pdf
public class MyLinkedListltE extends ComparableltEgtg.pdf
 
How to do insertion sort on a singly linked list with no header usin.pdf
How to do insertion sort on a singly linked list with no header usin.pdfHow to do insertion sort on a singly linked list with no header usin.pdf
How to do insertion sort on a singly linked list with no header usin.pdf
 

More from geetakannupillai1

Hidrojen ba bir elektropozitif hidrojen H atomunun civ.pdf
Hidrojen ba bir elektropozitif hidrojen H atomunun civ.pdfHidrojen ba bir elektropozitif hidrojen H atomunun civ.pdf
Hidrojen ba bir elektropozitif hidrojen H atomunun civ.pdfgeetakannupillai1
 
Hi In SE and under use case diagram we have 4 relationships.pdf
Hi In SE and under use case diagram we have 4 relationships.pdfHi In SE and under use case diagram we have 4 relationships.pdf
Hi In SE and under use case diagram we have 4 relationships.pdfgeetakannupillai1
 
Highlight the correct answer i have tried myself Pleas.pdf
Highlight the correct answer   i have tried myself   Pleas.pdfHighlight the correct answer   i have tried myself   Pleas.pdf
Highlight the correct answer i have tried myself Pleas.pdfgeetakannupillai1
 
High involvement and low involvement marketing Point Di.pdf
High involvement and low involvement marketing Point  Di.pdfHigh involvement and low involvement marketing Point  Di.pdf
High involvement and low involvement marketing Point Di.pdfgeetakannupillai1
 
Hi there Can you help me determine the sample and the popul.pdf
Hi there Can you help me determine the sample and the popul.pdfHi there Can you help me determine the sample and the popul.pdf
Hi there Can you help me determine the sample and the popul.pdfgeetakannupillai1
 
help please Please respond to this post by choosing any o.pdf
help please  Please respond to this post by choosing any o.pdfhelp please  Please respond to this post by choosing any o.pdf
help please Please respond to this post by choosing any o.pdfgeetakannupillai1
 
Hi There Please help me with 1 The python code AND .pdf
Hi There   Please help me with 1 The python code  AND .pdfHi There   Please help me with 1 The python code  AND .pdf
Hi There Please help me with 1 The python code AND .pdfgeetakannupillai1
 
Hi Im currently working on my python assignment and Im st.pdf
Hi Im currently working on my python assignment and Im st.pdfHi Im currently working on my python assignment and Im st.pdf
Hi Im currently working on my python assignment and Im st.pdfgeetakannupillai1
 
Hi I need help with just step c of this question The rest.pdf
Hi I need help with just step c of this question The rest.pdfHi I need help with just step c of this question The rest.pdf
Hi I need help with just step c of this question The rest.pdfgeetakannupillai1
 
Hi Experts Could some one please explain with a practical e.pdf
Hi Experts  Could some one please explain with a practical e.pdfHi Experts  Could some one please explain with a practical e.pdf
Hi Experts Could some one please explain with a practical e.pdfgeetakannupillai1
 
hhmi Biolnteractive Inheritance and Mutations in a SingleGe.pdf
hhmi Biolnteractive Inheritance and Mutations in a SingleGe.pdfhhmi Biolnteractive Inheritance and Mutations in a SingleGe.pdf
hhmi Biolnteractive Inheritance and Mutations in a SingleGe.pdfgeetakannupillai1
 
Heteraride st ynetimin rol Soru seenekleri 1 kat.pdf
Heteraride st ynetimin rol  Soru seenekleri    1  kat.pdfHeteraride st ynetimin rol  Soru seenekleri    1  kat.pdf
Heteraride st ynetimin rol Soru seenekleri 1 kat.pdfgeetakannupillai1
 
Herzbergs twofactor theory proposes that A lower wages w.pdf
Herzbergs twofactor theory proposes that A lower wages w.pdfHerzbergs twofactor theory proposes that A lower wages w.pdf
Herzbergs twofactor theory proposes that A lower wages w.pdfgeetakannupillai1
 
Herhangi iki i A tr Elektronik Ticarete Girite Kutz tara.pdf
Herhangi iki i A tr Elektronik Ticarete Girite Kutz tara.pdfHerhangi iki i A tr Elektronik Ticarete Girite Kutz tara.pdf
Herhangi iki i A tr Elektronik Ticarete Girite Kutz tara.pdfgeetakannupillai1
 
Help with media assessment In April 2022 WarnerMedia Owne.pdf
Help with media assessment In April 2022 WarnerMedia Owne.pdfHelp with media assessment In April 2022 WarnerMedia Owne.pdf
Help with media assessment In April 2022 WarnerMedia Owne.pdfgeetakannupillai1
 
Here is support files a3_birthdaylibh ifndef A3_Q1_H defi.pdf
Here is support files a3_birthdaylibh ifndef A3_Q1_H defi.pdfHere is support files a3_birthdaylibh ifndef A3_Q1_H defi.pdf
Here is support files a3_birthdaylibh ifndef A3_Q1_H defi.pdfgeetakannupillai1
 
Here is two discussion board posts please give me a paragrap.pdf
Here is two discussion board posts please give me a paragrap.pdfHere is two discussion board posts please give me a paragrap.pdf
Here is two discussion board posts please give me a paragrap.pdfgeetakannupillai1
 
Here is The code in C language .pdf
Here is The code in C language  .pdfHere is The code in C language  .pdf
Here is The code in C language .pdfgeetakannupillai1
 
Helper T cells with a mutation called CCR5 delta 32 cannot .pdf
Helper T cells with a mutation called CCR5 delta 32 cannot .pdfHelper T cells with a mutation called CCR5 delta 32 cannot .pdf
Helper T cells with a mutation called CCR5 delta 32 cannot .pdfgeetakannupillai1
 
Here is the remaining question of the case study Under the .pdf
Here is the remaining question of the case study  Under the .pdfHere is the remaining question of the case study  Under the .pdf
Here is the remaining question of the case study Under the .pdfgeetakannupillai1
 

More from geetakannupillai1 (20)

Hidrojen ba bir elektropozitif hidrojen H atomunun civ.pdf
Hidrojen ba bir elektropozitif hidrojen H atomunun civ.pdfHidrojen ba bir elektropozitif hidrojen H atomunun civ.pdf
Hidrojen ba bir elektropozitif hidrojen H atomunun civ.pdf
 
Hi In SE and under use case diagram we have 4 relationships.pdf
Hi In SE and under use case diagram we have 4 relationships.pdfHi In SE and under use case diagram we have 4 relationships.pdf
Hi In SE and under use case diagram we have 4 relationships.pdf
 
Highlight the correct answer i have tried myself Pleas.pdf
Highlight the correct answer   i have tried myself   Pleas.pdfHighlight the correct answer   i have tried myself   Pleas.pdf
Highlight the correct answer i have tried myself Pleas.pdf
 
High involvement and low involvement marketing Point Di.pdf
High involvement and low involvement marketing Point  Di.pdfHigh involvement and low involvement marketing Point  Di.pdf
High involvement and low involvement marketing Point Di.pdf
 
Hi there Can you help me determine the sample and the popul.pdf
Hi there Can you help me determine the sample and the popul.pdfHi there Can you help me determine the sample and the popul.pdf
Hi there Can you help me determine the sample and the popul.pdf
 
help please Please respond to this post by choosing any o.pdf
help please  Please respond to this post by choosing any o.pdfhelp please  Please respond to this post by choosing any o.pdf
help please Please respond to this post by choosing any o.pdf
 
Hi There Please help me with 1 The python code AND .pdf
Hi There   Please help me with 1 The python code  AND .pdfHi There   Please help me with 1 The python code  AND .pdf
Hi There Please help me with 1 The python code AND .pdf
 
Hi Im currently working on my python assignment and Im st.pdf
Hi Im currently working on my python assignment and Im st.pdfHi Im currently working on my python assignment and Im st.pdf
Hi Im currently working on my python assignment and Im st.pdf
 
Hi I need help with just step c of this question The rest.pdf
Hi I need help with just step c of this question The rest.pdfHi I need help with just step c of this question The rest.pdf
Hi I need help with just step c of this question The rest.pdf
 
Hi Experts Could some one please explain with a practical e.pdf
Hi Experts  Could some one please explain with a practical e.pdfHi Experts  Could some one please explain with a practical e.pdf
Hi Experts Could some one please explain with a practical e.pdf
 
hhmi Biolnteractive Inheritance and Mutations in a SingleGe.pdf
hhmi Biolnteractive Inheritance and Mutations in a SingleGe.pdfhhmi Biolnteractive Inheritance and Mutations in a SingleGe.pdf
hhmi Biolnteractive Inheritance and Mutations in a SingleGe.pdf
 
Heteraride st ynetimin rol Soru seenekleri 1 kat.pdf
Heteraride st ynetimin rol  Soru seenekleri    1  kat.pdfHeteraride st ynetimin rol  Soru seenekleri    1  kat.pdf
Heteraride st ynetimin rol Soru seenekleri 1 kat.pdf
 
Herzbergs twofactor theory proposes that A lower wages w.pdf
Herzbergs twofactor theory proposes that A lower wages w.pdfHerzbergs twofactor theory proposes that A lower wages w.pdf
Herzbergs twofactor theory proposes that A lower wages w.pdf
 
Herhangi iki i A tr Elektronik Ticarete Girite Kutz tara.pdf
Herhangi iki i A tr Elektronik Ticarete Girite Kutz tara.pdfHerhangi iki i A tr Elektronik Ticarete Girite Kutz tara.pdf
Herhangi iki i A tr Elektronik Ticarete Girite Kutz tara.pdf
 
Help with media assessment In April 2022 WarnerMedia Owne.pdf
Help with media assessment In April 2022 WarnerMedia Owne.pdfHelp with media assessment In April 2022 WarnerMedia Owne.pdf
Help with media assessment In April 2022 WarnerMedia Owne.pdf
 
Here is support files a3_birthdaylibh ifndef A3_Q1_H defi.pdf
Here is support files a3_birthdaylibh ifndef A3_Q1_H defi.pdfHere is support files a3_birthdaylibh ifndef A3_Q1_H defi.pdf
Here is support files a3_birthdaylibh ifndef A3_Q1_H defi.pdf
 
Here is two discussion board posts please give me a paragrap.pdf
Here is two discussion board posts please give me a paragrap.pdfHere is two discussion board posts please give me a paragrap.pdf
Here is two discussion board posts please give me a paragrap.pdf
 
Here is The code in C language .pdf
Here is The code in C language  .pdfHere is The code in C language  .pdf
Here is The code in C language .pdf
 
Helper T cells with a mutation called CCR5 delta 32 cannot .pdf
Helper T cells with a mutation called CCR5 delta 32 cannot .pdfHelper T cells with a mutation called CCR5 delta 32 cannot .pdf
Helper T cells with a mutation called CCR5 delta 32 cannot .pdf
 
Here is the remaining question of the case study Under the .pdf
Here is the remaining question of the case study  Under the .pdfHere is the remaining question of the case study  Under the .pdf
Here is the remaining question of the case study Under the .pdf
 

Recently uploaded

Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxdhanalakshmis0310
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 

Recently uploaded (20)

Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 

here is the starter code public class LinkedListPracticeLab.pdf

  • 1. here is the starter code: public class LinkedListPracticeLab { private LinkedListPracticeLab(){} public static void main(String[] args) { // Test all methods here } /** * Given the heads of two sorted linked lists, merges the two lists in a one sorted list. * The list is made by splicing together the nodes of the original two lists, without * creating any new nodes. * * Returns the head of the merged linked list. */ public static ListNode mergeLists(ListNode head1, ListNode head2) { return null; } /** * Given the head of a sorted linked list, deletes all duplicates such that each element appears only once. * * Returns the head of the resulting linked list, which is still sorted. */ public static ListNode deleteDuplicates(ListNode head) { return null; } /** * Given the head of a linked list and an integer val, removes all the nodes of the linked list that has * Node.val == val. * * Returns the head of the resulting list. */ public static ListNode removeElements(ListNode head, int val) { return null; } /** * Given the head of a zero-indexed linked list and two indices i and j, swaps the elements at these indices. * * Returns the head of the resulting list.
  • 2. */ public static ListNode swapElements(ListNode head, int i, int j) { return null; } /** * Given the head of a singly linked list, reverse the list, and return the reversed list. */ public static ListNode reverseList(ListNode head) { return null; } /** * Given the head of a singly linked list, returns the middle node of the linked list. * * If there are an even number of elements -- and thus two middle nodes -- returns the second middle node. */ public static ListNode middleNode(ListNode head) { return null; } } list node.java code: /** * Definition for singly-linked list. */ public class ListNode { int val; ListNode next; ListNode() {} ListNode(int val) { this.val = val; } ListNode(int val, ListNode next) { this.val = val; this.next = next; } } List utils.java code /** * Utilities for singly-linked non-circular lists. */ public class ListUtils { private ListUtils() {} static ListNode copyList(ListNode list) { ListNode head = new ListNode(list.val); ListNode currentNew = head;
  • 3. ListNode currentOld = list.next; while(currentOld != null) { currentNew.next = new ListNode(currentOld.val); currentNew = currentNew.next; currentOld = currentOld.next; } return head; } static void displayList(ListNode list) { if(list == null) { System.out.println("[]"); return; } StringBuilder sb = new StringBuilder(); sb.append('['); while(list != null) { sb.append(list.val); sb.append(','); sb.append(' '); list = list.next; } sb.delete(sb.lastIndexOf(","), sb.length()); sb.append(']'); System.out.println(sb); } static ListNode arrayToLinkedList(int[] arr) { if(arr.length == 0) return null; ListNode head = new ListNode(arr[0]); ListNode current = head; for(int i = 1; i < arr.length; i++) { current.next = new ListNode(arr[i]); current = current.next; } return head; } } For this lab you will solve a few separate problems that involve linked lists. Some of these problems are taken from leetcode, but in a few instances are made small changes. TASK 1 display linked lists. TASK 2 Download this starter code: LinkedListPracticeLab.java you are trying to solve! And when designing your solution you may want to make some drawings of how the linked lists are being manipulated. TASK 3 the tests. But make sure you include several tests for
  • 4. each solution, and that you test for "special" or "boundary" cases. Submit: Your version of LinkedListPracticeLab.java. For each implemented method, a screenshot showing tests for that method.