Subjects
PRICING
COURSES
SIGN IN
Start Free Trial
Rushwell D.
Tutor for 2 years
Tutor Satisfaction Guarantee
Java Programming
TutorMe
Question:

Create a testClass that demonstrates the addFront, reverse and toString method of the provided LL (linkedList class). import java.util.*; public class LL { private Node head; private Node tail; int size; private static class Node { private int data; private Node next; public Node(int d, Node n) { data =d; next =n; } } public void addfront(int x) { if(head == null) //empty list to start with { head= new Node(x, null); tail = head; } else { head = new Node(x, head); } size ++; } public void addEnd(int x) { if(head == null) { head = new Node(x, null); } else { tail.next = new Node(x, null); tail = tail.next; } size ++; } public void removeFront() { if (head == null)//empty { throw new NoSuchElementException(); } else { if ( head == tail) //if you have no node or one node { head = tail = null; } else //more than one node { head = head.next; } size --; } } public void removeEnd() { if(head ==null)// if its empty { throw new NoSuchElementException(); } else { if(head == tail) //one node { head = tail = null; } else //more than one node { Node p = head; while(p.next != tail) p = p.next; p.next =null; tail = p; } size --; } } public void reverse() { if(size <2) return; Node p1, p2, p3; p1 = null; p2 = head; p3 = head.next; while(p3 != null) { p2.next = p1; p1 = p2; p2 = p3; p3 = p3.next; } p2.next = p1; tail = head; head = p2; } public int get(int i) { if(i < 0 || i == size) throw new NoSuchElementException(); Node p = head; for(int k=0; k < i; k++) p = p.next; return p.data; } public String toString() { StringBuilder sb = new StringBuilder("[ "); Node p = head; while(p != null) { sb.append(p.data + " "); p = p.next; } sb.append("]"); return new String(sb); } }

Rushwell D.
Answer:

public class testLL { public static void main(String[] args) { LL list = new LL(); for(int i =1; i <= 5 ; i ++) { list.addfront(i); } System.out.println(list); list.reverse(); System.out.println(list); System.out.println("Get each node by index"); for (int i=0; i < list.size; i++) { System.out.println(list.get(i)); } } }

Calculus
TutorMe
Question:

Find all the partial derivative with respect to x to the following function. f(x, y) = 2x sin((x^2)*y)

Rushwell D.
Answer:

f_x = 2x*cos(x^2*y). 2xy + 2sin(x^2*y) = 4x^2*ycos(x^2*y) + 2sin(x^2*y);

Algebra
TutorMe
Question:

Solve the following system of equations 3x + y = 13 x + 6y = -7

Rushwell D.
Answer:

Solution by Addition or Subtraction 3x + y = 13 x + 6y = -7 3x + y = 13 multiply to get equal coefficients 3(x +6y = -7) 3x + y = 13 subtract -3x -18y = 21 -17y = 34 y = -2 answer for y 3x + (-2) = 13 substitute to get answer for x 3x = 15 x = 5 Solution by Substitution 3x + y = 13 x + 6y = -7 y = 13 -3x solve first equation for "y=" x + 6(13 - 3x) = -7 substitute into the second x + 78 - 18x = -7 -17x + 78 = -7 -17x = -85 x = 5 answer for x 3x + y = 13 substitute to get answer for y 3(5) + y = 13 15 + y = 13 y = -2

Send a message explaining your
needs and Rushwell will reply soon.
Contact Rushwell
Ready now? Request a lesson.
Start Session
FAQs
What is a lesson?
A lesson is virtual lesson space on our platform where you and a tutor can communicate. You'll have the option to communicate using video/audio as well as text chat. You can also upload documents, edit papers in real time and use our cutting-edge virtual whiteboard.
How do I begin a lesson?
If the tutor is currently online, you can click the "Start Session" button above. If they are offline, you can always send them a message to schedule a lesson.
Who are TutorMe tutors?
Many of our tutors are current college students or recent graduates of top-tier universities like MIT, Harvard and USC. TutorMe has thousands of top-quality tutors available to work with you.