Answer questions 1-2 based on this array. 1.Write statements to declare the array and assign the values
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 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)
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.
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 ?
Concepts of Database Management
ISBN: 978-1285427102
8th edition
Authors: Philip J. Pratt, Mary Z. Last