- 2 Marks Stackll Class Total Complete The Functionality Of The Following Method 1 Swapsmallestlargest Method Write C 1 (210.84 KiB) Viewed 16 times
[2 marks] StackLL class Total Complete the functionality of the following method 1. swapSmallestLargest() Method Write c
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
[2 marks] StackLL class Total Complete the functionality of the following method 1. swapSmallestLargest() Method Write c
[2 marks] StackLL class Total Complete the functionality of the following method 1. swapSmallestLargest() Method Write code in this method to Find the smallest and largest elements of the stack Swap these smallest and largest elements in the stack QueueLL class Total [2 marks] Complete the functionality of the following methods 1. addEvenSubOdd(Method Write code to add some value (stored in ‘value2change' variable) in all even nodes and subtract it from all odd nodes of queue . FinalLabExam_Spring2022 class Total (16 marks] 1. In choice 1, write code here to reverse the elements of the Stack and then [5 marks] display these elements after reversing. Note: (i) You can create any other stack or queue for this purpose. You should use only push(), popo, enqueue() and dequeue() methods. 2. In choice 2, write code here to delete specific element of the queue and then [5 marks] display all elements of the queue after deleting this element. a) Get Int value from the user to delete from the queue q1 b) Remove all elements of queue ql and copy them onto the queue q2 except the value you want to delete c) Now remove all elements of queue 42 and copy them onto the original queue q1 d) Display all elements of queue ql. 3. In choice 3, write code here to add specific value in all EVEN nodes and [5 marks] subtract this value from all ODD nodes of queue by performing following actions. a) Ask the user to enter a value to add/subtract from queue ql elements b) Call the related method 'addEvenSubOdd' by passing this ‘value2change as parameter to it c) Display (Print) the elements of queue ql after changing the nodes 4 In choice 4, write code to call an appropriate method to swap the smallest and largest elements of the stack [1 mark]