Computers and Technology, 04.03.2021 23:20 jamesgotqui6
Can someone urgently help me with my java code (I WILL GIVE BRAINLIEST)?! Ive been working on it for hours and its not working! (please give an actual answer...)
*examples of required output at the bottom*
code: public class CircularList
{
private ListNode head;
private ListNode tail;
private int size;
public CircularList()
{
head = tail = null;
size = 0;
}
public int size()
{
return size;
}
public boolean isEmpty()
{
return (size == 0);
}
public int first()
{
if (head != null) {
return head. getValue();
}
return -1;
}
public Integer last()
{
if (tail != null) {
return tail. getValue();
}
return -1;
}
public void addFirst(Integer value)
{
head = new ListNode(value, head);
if (tail == null) {
tail = head;
}
size++;
}
public void addLast(Integer value)
{
ListNode newTail = new ListNode(value, null);
if (tail != null) {
tail. setNext(newTail);
tail = newTail;
} else {
head = tail = newTail;
}
size++;
}
public void addAtPos(int pos, Integer value)
{
if (pos == 0) {
addFirst(value);
return;
}
if (pos <= 0 || pos > size) {
return;
}
if (pos == size) {
addLast(value);
return;
}
ListNode ptr = head;
for(int i=0; i = size) {
return retVal;
}
if (pos == 0) {
return removeFirst();
}
ListNode ptr = head;
for(int i=0; i
ptr = ptr. getNext();
}
retVal = ptr. getNext().getValue();
if (pos == size-1) {
tail = ptr;
tail. setNext(null);
} else {
ptr. setNext(ptr. getNext().getNext());
}
size--;
return retVal;
}
public int findNode(Integer find)
{
ListNode ptr = head;
for(int pos=0; pos
if (ptr. getValue() == find) {
return pos;
}
ptr = ptr. getNext();
}
return -1;
}
public void rotate()
{
addLast(removeFirst());
}
public String toString()
{
String output = "";
ListNode iter = head;
while(iter != null) {
output += String. format("%d ", iter. getValue());
iter = iter. getNext();
}
return output;
}
}
size = 6 first = 50 last = 60
50 20 10 40 30 60
removeFirst = 50
size = 5 first = 20 last = 60
20 10 40 30 60
removed = 30
size = 4 first = 20 last = 60
20 10 40 60
size = 4 first = 20 last = 60
20 10 40 60
found at -1
removed = -1
size = 4 first = 20 last = 60
20 10 40 60
size = 4 first = 10 last = 20
10 40 60 20
Answers: 2
Computers and Technology, 22.06.2019 12:40
In a response of approximately 50 words, explain why it would be essential for the successful a/v technician to participate in additional coursework, presentations and seminars offered by equipment manufacturers as well as annual conferences attended by colleagues in the industry.
Answers: 1
Computers and Technology, 22.06.2019 20:10
Assume that minutes is an int variable whose value is 0 or positive. write an expression whose value is "undercooked" or "soft-boiled" or "medium-boiled" or "hard-boiled" or "overcooked" based on the value of minutes. in particular: if the value of minutes is less than 2 the expression's value is "undercooked"; 2-4 would be a "soft-boiled", 5-7 would be "medium-boiled", 8-11 would be "hard-boiled" and 12 or more would be a "overcooked".
Answers: 1
Computers and Technology, 23.06.2019 07:00
To produce a starlight effect in her photograph, lina should choose the filter for her camera.
Answers: 1
Computers and Technology, 23.06.2019 20:10
Leo is a recruitment executive for a large company. he has identified new labor resource requirements in both the marketing and production departments. what should be his first step in recruiting candidates for the positions? a. conduct background checks of candidates b. make job offers c. arrange interviews d. conduct reference checks e. place job ads on job sites
Answers: 1
Can someone urgently help me with my java code (I WILL GIVE BRAINLIEST)?! Ive been working on it for...
Mathematics, 16.07.2019 14:10
Mathematics, 16.07.2019 14:10
History, 16.07.2019 14:10
History, 16.07.2019 14:10
History, 16.07.2019 14:10
Mathematics, 16.07.2019 14:10
Mathematics, 16.07.2019 14:10
Mathematics, 16.07.2019 14:10
Mathematics, 16.07.2019 14:10
Mathematics, 16.07.2019 14:10
Mathematics, 16.07.2019 14:10
History, 16.07.2019 14:10