SlideShare a Scribd company logo
write on this code:
/**
* A Sentinel List has two special nodes with values __HEAD__ and
* __SENTINEL__ at each end
*/
public class SentinelList {
/**
* Create an empty sentinel list
*/
public SentinelList() {
}
/**
* Return the special head node
*/
public Node getHead() {
return null;
}
/**
* Return the special sentinel node
*/
public Node getSentinel() {
return null;
}
/**
* Return the number of elements in the sentinel list
*/
public int size() {
return 0;
}
/**
* Add this value to the front of the list
*/
public void addFront(String value) {
}
/**
* Add this value to the back of the list
*/
public void addBack(String value) {
}
/**
* Remove the first occurrence of this value from the list.
* Return true if the value was found and removed, or false otherwise.
*/
public boolean remove(String value) {
return false;
}
/**
* Return if the value was found in the list, or false otherwise
*/
public boolean lookup(String value) {
return false;
}
public static void main(String[] args) {
SentinelList sl = new SentinelList();
sl.addBack("Bar");
sl.addFront("Foo");
sl.addFront("Clouds");
boolean result = sl.remove("Bar");
System.out.println(result); // should be true
result = sl.remove("Thunder");
System.out.println(result); // should be false
// Should print __Head__, Clouds, Foo, __Sentinel__
for (Node node = sl.getHead(); node != null; node = node.getNext()) {
System.out.print(node.getValue() + " ");
}
System.out.println();
}
}
Introduction A Sentinel List is a singly linked list with two special nodes at each end: a head and a
tail. The figure below illustrates a sentinel list with two elements, "foo" and "bar". The head node
has a special value, "_HEAD__. The sentinel node at the end has a special value,
"_SENTINEL_.". Note that there are double underscores at the beginning and end of the special
values. An empty SentinelList has only the head connected to the sentinel, with the sentinel
connected to null. The two special nodes are never removed and always anchor the two ends of
the list. Having sentinels can be a big help in coding linked lists. They simplify adding and
removing. Your Task You are given a class Node that implements a node in the linked list. Values
are Strings. Your task is to implement the SentinelList class with these methods: - public
sentinellist() - Create an empty sentinel list. The empty sentinel list of size 0 has two special
nodes, a head with value "_HEAD__ and a sentinel at the end with value "_SENTINEL_". - public
Node getHead() - Return the special head node. - public Node getsentinel() - Return the special
sentinel node. - public int size() - Return the number of elements in the sentinel list. - public void
addFront(String value) -- Add the value to the front of the list - public boolean lookup(String value)
- Return true if the value was found at least once in the list, or false otherwise. - public void
addBack(String value) - Add the value to the end of the list - public boolean remove(String value) -
Remove the first occurrence of the value from the list. Return true if the value was found and
removed, otherwise return false. Testing There is a small test program in main. You can run it with
make run Automated tests are in Test/SentinelListTest.java. You can run the automated tests with

More Related Content

Similar to write on this code A Sentinel List has two special n.pdf

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
annaelctronics
 
package linkedLists- import java-util-Iterator- --- A class representi.pdf
package linkedLists- import java-util-Iterator- --- A class representi.pdfpackage linkedLists- import java-util-Iterator- --- A class representi.pdf
package linkedLists- import java-util-Iterator- --- A class representi.pdf
arcellzone
 
public class MyLinkedListltE extends ComparableltEgtg.pdf
public class MyLinkedListltE extends ComparableltEgtg.pdfpublic class MyLinkedListltE extends ComparableltEgtg.pdf
public class MyLinkedListltE extends ComparableltEgtg.pdf
accostinternational
 
package com.java2novice.ds.linkedlist;import java.util.NoSuchEleme.pdf
package com.java2novice.ds.linkedlist;import java.util.NoSuchEleme.pdfpackage com.java2novice.ds.linkedlist;import java.util.NoSuchEleme.pdf
package com.java2novice.ds.linkedlist;import java.util.NoSuchEleme.pdf
aptind
 
Implementation The starter code includes List.java. You should not c.pdf
Implementation The starter code includes List.java. You should not c.pdfImplementation The starter code includes List.java. You should not c.pdf
Implementation The starter code includes List.java. You should not c.pdf
maheshkumar12354
 
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
stopgolook
 
Note- Can someone help me with the public boolean isEmpty()- public bo.pdf
Note- Can someone help me with the public boolean isEmpty()- public bo.pdfNote- Can someone help me with the public boolean isEmpty()- public bo.pdf
Note- Can someone help me with the public boolean isEmpty()- public bo.pdf
Augstore
 
I have been tasked to write a code for a Singly Linked list that inc.pdf
I have been tasked to write a code for a Singly Linked list that inc.pdfI have been tasked to write a code for a Singly Linked list that inc.pdf
I have been tasked to write a code for a Singly Linked list that inc.pdf
arkmuzikllc
 
Given below is the completed implementation of MyLinkedList class. O.pdf
Given below is the completed implementation of MyLinkedList class. O.pdfGiven below is the completed implementation of MyLinkedList class. O.pdf
Given below is the completed implementation of MyLinkedList class. O.pdf
info430661
 
Please help me to make a programming project I have to sue them today- (1).pdf
Please help me to make a programming project I have to sue them today- (1).pdfPlease help me to make a programming project I have to sue them today- (1).pdf
Please help me to make a programming project I have to sue them today- (1).pdf
seoagam1
 
The MyLinkedList class used in Listing 24.6 is a one-way directional .docx
 The MyLinkedList class used in Listing 24.6 is a one-way directional .docx The MyLinkedList class used in Listing 24.6 is a one-way directional .docx
The MyLinkedList class used in Listing 24.6 is a one-way directional .docx
Komlin1
 
The LinkedList1 class implements a Linked list. class.pdf
The LinkedList1 class implements a Linked list. class.pdfThe LinkedList1 class implements a Linked list. class.pdf
The LinkedList1 class implements a Linked list. class.pdf
malavshah9013
 
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
SHIVA101531
 
we using java dynamicArray package modellinearpub imp.pdf
we using java dynamicArray    package modellinearpub   imp.pdfwe using java dynamicArray    package modellinearpub   imp.pdf
we using java dynamicArray package modellinearpub imp.pdf
adityagupta3310
 
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
Conint29
 
Write a function to merge two doubly linked lists. The input lists ha.pdf
Write a function to merge two doubly linked lists. The input lists ha.pdfWrite a function to merge two doubly linked lists. The input lists ha.pdf
Write a function to merge two doubly linked lists. The input lists ha.pdf
info706022
 
here is the starter code public class LinkedListPracticeLab.pdf
here is the starter code public class LinkedListPracticeLab.pdfhere is the starter code public class LinkedListPracticeLab.pdf
here is the starter code public class LinkedListPracticeLab.pdf
geetakannupillai1
 
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdfC++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
poblettesedanoree498
 
Objective Binary Search Tree traversal (2 points)Use traversal.pp.pdf
Objective Binary Search Tree traversal (2 points)Use traversal.pp.pdfObjective Binary Search Tree traversal (2 points)Use traversal.pp.pdf
Objective Binary Search Tree traversal (2 points)Use traversal.pp.pdf
sivakumar19831
 
Implement the additional 5 methods as indicated in the LinkedList fi.pdf
Implement the additional 5 methods as indicated in the LinkedList fi.pdfImplement the additional 5 methods as indicated in the LinkedList fi.pdf
Implement the additional 5 methods as indicated in the LinkedList fi.pdf
footstatus
 

Similar to write on this code A Sentinel List has two special n.pdf (20)

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
 
package linkedLists- import java-util-Iterator- --- A class representi.pdf
package linkedLists- import java-util-Iterator- --- A class representi.pdfpackage linkedLists- import java-util-Iterator- --- A class representi.pdf
package linkedLists- import java-util-Iterator- --- A class representi.pdf
 
public class MyLinkedListltE extends ComparableltEgtg.pdf
public class MyLinkedListltE extends ComparableltEgtg.pdfpublic class MyLinkedListltE extends ComparableltEgtg.pdf
public class MyLinkedListltE extends ComparableltEgtg.pdf
 
package com.java2novice.ds.linkedlist;import java.util.NoSuchEleme.pdf
package com.java2novice.ds.linkedlist;import java.util.NoSuchEleme.pdfpackage com.java2novice.ds.linkedlist;import java.util.NoSuchEleme.pdf
package com.java2novice.ds.linkedlist;import java.util.NoSuchEleme.pdf
 
Implementation The starter code includes List.java. You should not c.pdf
Implementation The starter code includes List.java. You should not c.pdfImplementation The starter code includes List.java. You should not c.pdf
Implementation The starter code includes List.java. You should not c.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
 
Note- Can someone help me with the public boolean isEmpty()- public bo.pdf
Note- Can someone help me with the public boolean isEmpty()- public bo.pdfNote- Can someone help me with the public boolean isEmpty()- public bo.pdf
Note- Can someone help me with the public boolean isEmpty()- public bo.pdf
 
I have been tasked to write a code for a Singly Linked list that inc.pdf
I have been tasked to write a code for a Singly Linked list that inc.pdfI have been tasked to write a code for a Singly Linked list that inc.pdf
I have been tasked to write a code for a Singly Linked list that inc.pdf
 
Given below is the completed implementation of MyLinkedList class. O.pdf
Given below is the completed implementation of MyLinkedList class. O.pdfGiven below is the completed implementation of MyLinkedList class. O.pdf
Given below is the completed implementation of MyLinkedList class. O.pdf
 
Please help me to make a programming project I have to sue them today- (1).pdf
Please help me to make a programming project I have to sue them today- (1).pdfPlease help me to make a programming project I have to sue them today- (1).pdf
Please help me to make a programming project I have to sue them today- (1).pdf
 
The MyLinkedList class used in Listing 24.6 is a one-way directional .docx
 The MyLinkedList class used in Listing 24.6 is a one-way directional .docx The MyLinkedList class used in Listing 24.6 is a one-way directional .docx
The MyLinkedList class used in Listing 24.6 is a one-way directional .docx
 
The LinkedList1 class implements a Linked list. class.pdf
The LinkedList1 class implements a Linked list. class.pdfThe LinkedList1 class implements a Linked list. class.pdf
The LinkedList1 class implements a Linked list. class.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
 
we using java dynamicArray package modellinearpub imp.pdf
we using java dynamicArray    package modellinearpub   imp.pdfwe using java dynamicArray    package modellinearpub   imp.pdf
we using java dynamicArray package modellinearpub imp.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
 
Write a function to merge two doubly linked lists. The input lists ha.pdf
Write a function to merge two doubly linked lists. The input lists ha.pdfWrite a function to merge two doubly linked lists. The input lists ha.pdf
Write a function to merge two doubly linked lists. The input lists ha.pdf
 
here is the starter code public class LinkedListPracticeLab.pdf
here is the starter code public class LinkedListPracticeLab.pdfhere is the starter code public class LinkedListPracticeLab.pdf
here is the starter code public class LinkedListPracticeLab.pdf
 
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdfC++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
 
Objective Binary Search Tree traversal (2 points)Use traversal.pp.pdf
Objective Binary Search Tree traversal (2 points)Use traversal.pp.pdfObjective Binary Search Tree traversal (2 points)Use traversal.pp.pdf
Objective Binary Search Tree traversal (2 points)Use traversal.pp.pdf
 
Implement the additional 5 methods as indicated in the LinkedList fi.pdf
Implement the additional 5 methods as indicated in the LinkedList fi.pdfImplement the additional 5 methods as indicated in the LinkedList fi.pdf
Implement the additional 5 methods as indicated in the LinkedList fi.pdf
 

More from abifancystore

Aadaki ifadelerden hangisi yanltr ltfen sadece FALSE ifad.pdf
Aadaki ifadelerden hangisi yanltr ltfen sadece FALSE ifad.pdfAadaki ifadelerden hangisi yanltr ltfen sadece FALSE ifad.pdf
Aadaki ifadelerden hangisi yanltr ltfen sadece FALSE ifad.pdf
abifancystore
 
Chemical and manufacturing plants sometimes discharge toxic .pdf
Chemical and manufacturing plants sometimes discharge toxic .pdfChemical and manufacturing plants sometimes discharge toxic .pdf
Chemical and manufacturing plants sometimes discharge toxic .pdf
abifancystore
 
6 Matching Match each statement with an answer from the li.pdf
6 Matching Match each statement with an answer from the li.pdf6 Matching Match each statement with an answer from the li.pdf
6 Matching Match each statement with an answer from the li.pdf
abifancystore
 
Cules de los siguientes son mtodos de investigacin de ac.pdf
Cules de los siguientes son mtodos de investigacin de ac.pdfCules de los siguientes son mtodos de investigacin de ac.pdf
Cules de los siguientes son mtodos de investigacin de ac.pdf
abifancystore
 
Cmo se combinaron las nuevas tecnologas con la llegada de.pdf
Cmo se combinaron las nuevas tecnologas con la llegada de.pdfCmo se combinaron las nuevas tecnologas con la llegada de.pdf
Cmo se combinaron las nuevas tecnologas con la llegada de.pdf
abifancystore
 
Aadakilerden hangisi bir konak hcrede Influenza virs ya.pdf
Aadakilerden hangisi bir konak hcrede Influenza virs ya.pdfAadakilerden hangisi bir konak hcrede Influenza virs ya.pdf
Aadakilerden hangisi bir konak hcrede Influenza virs ya.pdf
abifancystore
 
Washington State recently adopted two new taxes that directl.pdf
Washington State recently adopted two new taxes that directl.pdfWashington State recently adopted two new taxes that directl.pdf
Washington State recently adopted two new taxes that directl.pdf
abifancystore
 
Why might the annual interest rate on a 2year US government.pdf
Why might the annual interest rate on a 2year US government.pdfWhy might the annual interest rate on a 2year US government.pdf
Why might the annual interest rate on a 2year US government.pdf
abifancystore
 
In the 1300s Europe was in the midst of decline and turmoil.pdf
In the 1300s Europe was in the midst of decline and turmoil.pdfIn the 1300s Europe was in the midst of decline and turmoil.pdf
In the 1300s Europe was in the midst of decline and turmoil.pdf
abifancystore
 
Topic Why is unemployment so high in Europe Briefly discus.pdf
Topic Why is unemployment so high in Europe Briefly discus.pdfTopic Why is unemployment so high in Europe Briefly discus.pdf
Topic Why is unemployment so high in Europe Briefly discus.pdf
abifancystore
 
Can someone give simple answers to these two questions Than.pdf
Can someone give simple answers to these two questions Than.pdfCan someone give simple answers to these two questions Than.pdf
Can someone give simple answers to these two questions Than.pdf
abifancystore
 
The trial balance for Best Advisors Service on December 31 .pdf
The trial balance for Best Advisors Service on December 31 .pdfThe trial balance for Best Advisors Service on December 31 .pdf
The trial balance for Best Advisors Service on December 31 .pdf
abifancystore
 
Calculate the dominant allele D frequency for this populat.pdf
Calculate the dominant allele D frequency for this populat.pdfCalculate the dominant allele D frequency for this populat.pdf
Calculate the dominant allele D frequency for this populat.pdf
abifancystore
 
the probabiilty of obtaining a success Round your answer to.pdf
the probabiilty of obtaining a success Round your answer to.pdfthe probabiilty of obtaining a success Round your answer to.pdf
the probabiilty of obtaining a success Round your answer to.pdf
abifancystore
 
Suppose that you are given a decision situation with three p.pdf
Suppose that you are given a decision situation with three p.pdfSuppose that you are given a decision situation with three p.pdf
Suppose that you are given a decision situation with three p.pdf
abifancystore
 
Sicklecell anemia is a recessive trait in humans In order .pdf
Sicklecell anemia is a recessive trait in humans In order .pdfSicklecell anemia is a recessive trait in humans In order .pdf
Sicklecell anemia is a recessive trait in humans In order .pdf
abifancystore
 
Revenue Recognition for Facebook and twitter for the year 20.pdf
Revenue Recognition for Facebook and twitter for the year 20.pdfRevenue Recognition for Facebook and twitter for the year 20.pdf
Revenue Recognition for Facebook and twitter for the year 20.pdf
abifancystore
 
begintabularlcc hline multicolumn1c Contribut.pdf
begintabularlcc hline multicolumn1c Contribut.pdfbegintabularlcc hline multicolumn1c Contribut.pdf
begintabularlcc hline multicolumn1c Contribut.pdf
abifancystore
 
Question 26 1 pts Which of the following is NOT true of all .pdf
Question 26 1 pts Which of the following is NOT true of all .pdfQuestion 26 1 pts Which of the following is NOT true of all .pdf
Question 26 1 pts Which of the following is NOT true of all .pdf
abifancystore
 
Question 04 Find the mean median and mode of the followin.pdf
Question 04 Find the mean median and mode of the followin.pdfQuestion 04 Find the mean median and mode of the followin.pdf
Question 04 Find the mean median and mode of the followin.pdf
abifancystore
 

More from abifancystore (20)

Aadaki ifadelerden hangisi yanltr ltfen sadece FALSE ifad.pdf
Aadaki ifadelerden hangisi yanltr ltfen sadece FALSE ifad.pdfAadaki ifadelerden hangisi yanltr ltfen sadece FALSE ifad.pdf
Aadaki ifadelerden hangisi yanltr ltfen sadece FALSE ifad.pdf
 
Chemical and manufacturing plants sometimes discharge toxic .pdf
Chemical and manufacturing plants sometimes discharge toxic .pdfChemical and manufacturing plants sometimes discharge toxic .pdf
Chemical and manufacturing plants sometimes discharge toxic .pdf
 
6 Matching Match each statement with an answer from the li.pdf
6 Matching Match each statement with an answer from the li.pdf6 Matching Match each statement with an answer from the li.pdf
6 Matching Match each statement with an answer from the li.pdf
 
Cules de los siguientes son mtodos de investigacin de ac.pdf
Cules de los siguientes son mtodos de investigacin de ac.pdfCules de los siguientes son mtodos de investigacin de ac.pdf
Cules de los siguientes son mtodos de investigacin de ac.pdf
 
Cmo se combinaron las nuevas tecnologas con la llegada de.pdf
Cmo se combinaron las nuevas tecnologas con la llegada de.pdfCmo se combinaron las nuevas tecnologas con la llegada de.pdf
Cmo se combinaron las nuevas tecnologas con la llegada de.pdf
 
Aadakilerden hangisi bir konak hcrede Influenza virs ya.pdf
Aadakilerden hangisi bir konak hcrede Influenza virs ya.pdfAadakilerden hangisi bir konak hcrede Influenza virs ya.pdf
Aadakilerden hangisi bir konak hcrede Influenza virs ya.pdf
 
Washington State recently adopted two new taxes that directl.pdf
Washington State recently adopted two new taxes that directl.pdfWashington State recently adopted two new taxes that directl.pdf
Washington State recently adopted two new taxes that directl.pdf
 
Why might the annual interest rate on a 2year US government.pdf
Why might the annual interest rate on a 2year US government.pdfWhy might the annual interest rate on a 2year US government.pdf
Why might the annual interest rate on a 2year US government.pdf
 
In the 1300s Europe was in the midst of decline and turmoil.pdf
In the 1300s Europe was in the midst of decline and turmoil.pdfIn the 1300s Europe was in the midst of decline and turmoil.pdf
In the 1300s Europe was in the midst of decline and turmoil.pdf
 
Topic Why is unemployment so high in Europe Briefly discus.pdf
Topic Why is unemployment so high in Europe Briefly discus.pdfTopic Why is unemployment so high in Europe Briefly discus.pdf
Topic Why is unemployment so high in Europe Briefly discus.pdf
 
Can someone give simple answers to these two questions Than.pdf
Can someone give simple answers to these two questions Than.pdfCan someone give simple answers to these two questions Than.pdf
Can someone give simple answers to these two questions Than.pdf
 
The trial balance for Best Advisors Service on December 31 .pdf
The trial balance for Best Advisors Service on December 31 .pdfThe trial balance for Best Advisors Service on December 31 .pdf
The trial balance for Best Advisors Service on December 31 .pdf
 
Calculate the dominant allele D frequency for this populat.pdf
Calculate the dominant allele D frequency for this populat.pdfCalculate the dominant allele D frequency for this populat.pdf
Calculate the dominant allele D frequency for this populat.pdf
 
the probabiilty of obtaining a success Round your answer to.pdf
the probabiilty of obtaining a success Round your answer to.pdfthe probabiilty of obtaining a success Round your answer to.pdf
the probabiilty of obtaining a success Round your answer to.pdf
 
Suppose that you are given a decision situation with three p.pdf
Suppose that you are given a decision situation with three p.pdfSuppose that you are given a decision situation with three p.pdf
Suppose that you are given a decision situation with three p.pdf
 
Sicklecell anemia is a recessive trait in humans In order .pdf
Sicklecell anemia is a recessive trait in humans In order .pdfSicklecell anemia is a recessive trait in humans In order .pdf
Sicklecell anemia is a recessive trait in humans In order .pdf
 
Revenue Recognition for Facebook and twitter for the year 20.pdf
Revenue Recognition for Facebook and twitter for the year 20.pdfRevenue Recognition for Facebook and twitter for the year 20.pdf
Revenue Recognition for Facebook and twitter for the year 20.pdf
 
begintabularlcc hline multicolumn1c Contribut.pdf
begintabularlcc hline multicolumn1c Contribut.pdfbegintabularlcc hline multicolumn1c Contribut.pdf
begintabularlcc hline multicolumn1c Contribut.pdf
 
Question 26 1 pts Which of the following is NOT true of all .pdf
Question 26 1 pts Which of the following is NOT true of all .pdfQuestion 26 1 pts Which of the following is NOT true of all .pdf
Question 26 1 pts Which of the following is NOT true of all .pdf
 
Question 04 Find the mean median and mode of the followin.pdf
Question 04 Find the mean median and mode of the followin.pdfQuestion 04 Find the mean median and mode of the followin.pdf
Question 04 Find the mean median and mode of the followin.pdf
 

Recently uploaded

CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
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
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
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)
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
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
 
"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
 
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
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
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
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 

Recently uploaded (20)

CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
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
 
"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...
 
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
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
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...
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 

write on this code A Sentinel List has two special n.pdf

  • 1. write on this code: /** * A Sentinel List has two special nodes with values __HEAD__ and * __SENTINEL__ at each end */ public class SentinelList { /** * Create an empty sentinel list */ public SentinelList() { } /** * Return the special head node */ public Node getHead() { return null; } /** * Return the special sentinel node */ public Node getSentinel() { return null; } /** * Return the number of elements in the sentinel list */ public int size() { return 0; } /** * Add this value to the front of the list */ public void addFront(String value) { } /** * Add this value to the back of the list */ public void addBack(String value) { } /** * Remove the first occurrence of this value from the list. * Return true if the value was found and removed, or false otherwise.
  • 2. */ public boolean remove(String value) { return false; } /** * Return if the value was found in the list, or false otherwise */ public boolean lookup(String value) { return false; } public static void main(String[] args) { SentinelList sl = new SentinelList(); sl.addBack("Bar"); sl.addFront("Foo"); sl.addFront("Clouds"); boolean result = sl.remove("Bar"); System.out.println(result); // should be true result = sl.remove("Thunder"); System.out.println(result); // should be false // Should print __Head__, Clouds, Foo, __Sentinel__ for (Node node = sl.getHead(); node != null; node = node.getNext()) { System.out.print(node.getValue() + " "); } System.out.println(); } } Introduction A Sentinel List is a singly linked list with two special nodes at each end: a head and a tail. The figure below illustrates a sentinel list with two elements, "foo" and "bar". The head node has a special value, "_HEAD__. The sentinel node at the end has a special value, "_SENTINEL_.". Note that there are double underscores at the beginning and end of the special values. An empty SentinelList has only the head connected to the sentinel, with the sentinel connected to null. The two special nodes are never removed and always anchor the two ends of the list. Having sentinels can be a big help in coding linked lists. They simplify adding and removing. Your Task You are given a class Node that implements a node in the linked list. Values are Strings. Your task is to implement the SentinelList class with these methods: - public sentinellist() - Create an empty sentinel list. The empty sentinel list of size 0 has two special nodes, a head with value "_HEAD__ and a sentinel at the end with value "_SENTINEL_". - public Node getHead() - Return the special head node. - public Node getsentinel() - Return the special sentinel node. - public int size() - Return the number of elements in the sentinel list. - public void addFront(String value) -- Add the value to the front of the list - public boolean lookup(String value) - Return true if the value was found at least once in the list, or false otherwise. - public void addBack(String value) - Add the value to the end of the list - public boolean remove(String value) -
  • 3. Remove the first occurrence of the value from the list. Return true if the value was found and removed, otherwise return false. Testing There is a small test program in main. You can run it with make run Automated tests are in Test/SentinelListTest.java. You can run the automated tests with