final class Node { char info; Node next; public Node (char letter, Node node) info = letter; next = node; } Examples n1 - n4.next; n1.next = null; 2. Node instantiation n3.next.next new Node('B',...


Linked list manipulations question.


final class Node<br>{<br>char info;<br>Node next;<br>public Node (char letter, Node node)<br>info = letter;<br>next = node;<br>}<br>Examples<br>n1 - n4.next; n1.next = null;<br>2. Node instantiation n3.next.next new Node('B', null);<br>Construct<br>1. Assignment<br>3. Assignment<br>n1.info - n4.next.info; n1.next.info - 'c';<br>4. If statement<br>if (n1--null) {...) else (...}<br>while ( (ni!-null) && (n1.info=='A') ) {...)<br>5. While loop<br>Short exercises<br>For each exercise:<br>• Write the Java statements that will produce the

Extracted text: final class Node { char info; Node next; public Node (char letter, Node node) info = letter; next = node; } Examples n1 - n4.next; n1.next = null; 2. Node instantiation n3.next.next new Node('B', null); Construct 1. Assignment 3. Assignment n1.info - n4.next.info; n1.next.info - 'c'; 4. If statement if (n1--null) {...) else (...} while ( (ni!-null) && (n1.info=='A') ) {...) 5. While loop Short exercises For each exercise: • Write the Java statements that will produce the "initial setup" • Write the Java statements that will transform the inital setup into the "final configuration." User the Java Visualizer to execute your solution and visualize the data structures. Initial Setup Exercise Final Configuration Use a single assignment statement to make the variable p refer to the Node with linfo '2 3/ Redo exercise 1 but, this 2 users.csc.calpoly.edu/-jdalbey/103/Demo/LinkedListExercises/ 1/6 2/6/2021 Linked List Exercises time, your assignment statement must refer to both variables p and q. 1 2 3/ Use a single assignment statement to b. make the variable q refer to the Node with info 'l'. 3/ Use a single assignment statement to Imake the variable r refer to the Node with info '2'. 4 3/
Use a single<br>assignment<br>statement to<br>set the info<br>of the Node<br>referred to<br>by p equal<br>to the info<br>of the Node<br>referred to<br>-3A by r (you<br>must access<br>this info<br>through r;<br>do not refer<br>to the<br>character '3'<br>directly).<br>Redo<br>exercise 5<br>by referring<br>only to<br>variable p<br>(not to<br>variable r).<br>Again, you<br>may not<br>refer to the<br>character '3'<br>directly<br>Write a<br>single<br>assignment<br>3/<br>3/<br>users.csc.calpoly.edu/-jdalbey/103/Demo/LinkedListExercises/<br>2/6<br>2/6/2021<br>Linked List Exercises<br>statement to<br>transform<br>the linked<br>3 list headed<br>by p into a<br>circular<br>linked list.<br>Your<br>assignment<br>statement<br>must refer<br>to both<br>variables p<br>and r.<br>Redo<br>|ехercise 7<br>but, this<br>time, your<br>assignment<br>37 statement<br>must refer<br>to both<br>variables p<br>and q.<br>Redo<br>exercise 7<br>but, this<br>time, your<br>assignment<br>3 statement<br>must refer<br>only to<br>variable p.<br>2<br>3<br>

Extracted text: Use a single assignment statement to set the info of the Node referred to by p equal to the info of the Node referred to -3A by r (you must access this info through r; do not refer to the character '3' directly). Redo exercise 5 by referring only to variable p (not to variable r). Again, you may not refer to the character '3' directly Write a single assignment 3/ 3/ users.csc.calpoly.edu/-jdalbey/103/Demo/LinkedListExercises/ 2/6 2/6/2021 Linked List Exercises statement to transform the linked 3 list headed by p into a circular linked list. Your assignment statement must refer to both variables p and r. Redo |ехercise 7 but, this time, your assignment 37 statement must refer to both variables p and q. Redo exercise 7 but, this time, your assignment 3 statement must refer only to variable p. 2 3
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here