Question: 1. Write a program in Java to merge two integer arrays in sorted order. Declare two integer arrays of any size. Take the array sizes
1. Write a program in Java to merge two integer arrays in sorted order. Declare two integer arrays of any size. Take the array sizes from the user. Initialize the two arrays with the values given by the users in ascending order. Then declare the third array of appropriate size and merge the two arrays into the third large array in ascending order. Finally print all arrays. You can use Java Scanner class to take inputs from the user. The sample inputs/ outputs are given below. Sample inputs and outputs: (User's inputs are shown in bold) Enter the size of the first array: 3 Enter the elements of the first array in ascending order: 15 Enter the size of the second array: 5 Enter the elements of the second array in ascending order: 12 The elements of the first array: 5 8 15 The elements of the second array: 2 9 10 12 20 The elements of the third array: 2 5 8 9 10 12 15 20 2. Write a program in Java to implement a singly linked list where each node contains one integer value as element. Ask the user about the number of nodes to be inserted. Take that number of elements from the user, create the nodes one by one and insert the nodes in the linked list in descending order. Finally print the elements of the linked list. You can use Java Scanner class to take inputs from the user. The sample inputs outputs are given below. Sample inputs and outputs: (User's inputs are shown in bold) Enter the number of nodes of the singly linked list: 5 Enter the elements of the linked list: The elements of the linked list: 1273 21
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
