Computers and Technology, 04.03.2021 19:00 Triciamorrison
Can someone urgently help me with my java code? Ive been working on it for hours and its not working.
*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: 1
Computers and Technology, 22.06.2019 17:30
Working on this program in python 3.7: a year in the modern gregorian calendar consists of 365 days. in reality, the earth takes longer to rotate around the sun. to account for the difference in time, every 4 years, a leap year takes place. a leap year is when a year has 366 days: an extra day, february 29th. the requirements for a given year to be a leap year are: 1) the year must be divisible by 42) if the year is a century year (1700, 1800, the year must be evenly divisible by 400some example leap years are 1600, 1712, and 2016.write a program that takes in a year and determines whether that year is a leap year.ex: if the input is 1712, the output is: 1712 is a leap year. ex: if the input is 1913, the output is: 1913 is not a leap year. your program must define and call the function isleapyear(useryear). the function should return true if the input year is a leap year and false otherwise.
Answers: 1
Computers and Technology, 23.06.2019 02:30
Which component acts as a platform on which application software runs
Answers: 2
Computers and Technology, 23.06.2019 03:30
How can you repin an image on your pinterest pin board a. click on the "repin" button b. click on the "add pin" button c. click on the "upload a pin" button d. click on the "save pin" button.
Answers: 2
Computers and Technology, 24.06.2019 19:20
Kiesha has a worksheet with a range of cells using the following columns: name, score, group, study group, and date. kiesha needs to sort the worksheet on the date field. which option she use to most efficiently complete this task ? a use the cut and paste option to reorganize the data to fit that order b use the filter function to organize the data based on the date c use the order function to organize the data based on the date d use the sort function to organize the data based on date order
Answers: 3
Can someone urgently help me with my java code? Ive been working on it for hours and its not working...
History, 05.02.2020 03:59
Mathematics, 05.02.2020 03:59
History, 05.02.2020 03:59
English, 05.02.2020 03:59
English, 05.02.2020 03:59
English, 05.02.2020 03:59
History, 05.02.2020 03:59
Physics, 05.02.2020 03:59
Social Studies, 05.02.2020 03:59
Mathematics, 05.02.2020 03:59