Question: Answer questions 1-2 based on this array. 1.Write statements to declare the array and assign the values to the corresponding positions. (6 pts) 2.Show each

Answer questions 1-2 based on this array.

position 2 3 value 50 30 25 85 100

1.Write statements to declare the array and assign the values to the corresponding positions. (6 pts)

2.Show each step to sort the data in descending order by using a selection sort. (4 pts)

3.Given the linked list shown below, list the steps to insert the new node after the node referenced by p. (4 pts)

image

4. Given integer stack S and the following stack operations

1. S.push(45)

2. S.push(35)

3. S.push(75)

4. S.peek()

5. S.pop()

6. S.push(25)

7. S.push(15)

8. S.pop()

9. S.peek()

10. S.pop()

11. S.push(95)

12. S.pop()

13. S.push(35)

14. S.push(5)

What value is returned by each peek() operation? (2 pts)

Draw a diagram showing the final state of the stack. (10 pts)

5. Given the following queue operations

1. Q.enque(27)

2. Q.enque(43)

3. Q.enque(14)

4. Q.deque()

5. Q.enque(55)

6. Q.deque()

7. Q.deque()

8. Q.enque(23)

9. Q.enque(76)

10. Q.enque(5)

11. Q.enque(10)

Draw a diagram showing the final state of the queue. (10 pts)

Answer questions 6-10 based on the following tree.

image

6. Label the root and leaf nodes.

7. What is the maximum height of the tree?

8. What is the depth of node e2?

9. On what level is node e8?

10. What is the parent node of e3 ?

position 2 3 value 50 30 25 85 100

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

I will answer all these questions in JAVA language 1 int arr new int5 arr0 50 arr1 30 arr2 25 arr3 8... View full answer

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 Programming Questions!