Question: please i need this asap in java ill upvote QUESTION 4: [4 POINTS] Write a static method called getFirst that accepts an integer stack stk.

 please i need this asap in java ill upvote QUESTION 4:

[4 POINTS] Write a static method called getFirst that accepts an integerstack stk. Your method should return the element that has been addedfirst to the stack. If stk is empty then return -1. Make

please i need this asap in java ill upvote

QUESTION 4: [4 POINTS] Write a static method called getFirst that accepts an integer stack stk. Your method should return the element that has been added first to the stack. If stk is empty then return -1. Make sure that the stack content does not change when method finish its execution. public static Integer getFirst (ArrayStack stk) {// write your code below this line QUESTION 5: [5 POINTS] Write a static method called insertAtFront that receives two parameters: an integer queue and an integer array f. The method should insert the content of the array f at the front of the queue. The queue is large enough to store all array elements. public static void insertAtFront (ArrayUnbndQueue q, int [] f) { Assume you have the following list of nodes: 3 1-111-71-7146 Answer the following questions: A. Delete the first node (1 Point) B. Insert a new node which stores the value 3 just after the node w. (2 Points) QUESTION 4: [4 POINTS] Consider the following linked list with three references list, a and b to answer the following: 18 32 74 16 43 87 25 44 list 1-41 a b 4.1 What is the output for each of the following statements: a) System.out.println (list.getInfo(); [1 point] [0.5 point] b) System.out.println (b.getLink().getLink().getInfo()); [0.5 point] 4.2 Write Java statement(s) to do the following: a) Set the value of the node containing 43 to be 55 using reference variable a. [3 points) [0.5 point] b) Write Java statement(s) to delete the node with info 25 using the reference variable b. [0.5 point c) Write Java statement(s) to create a new node called newNode with a value of 10 in its info, and then add it to the beginning of the list above. The list reference should refer to the beginning of

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!