Write a program using Java to find the middle node of a linked list (ensure that the number of nodes of the LL is an odd number).
Write a program using Java to reverse the elements of a linked list.
Write a program using Java to find the number of common elements of two linked lists.
e.g. 1 3 5 7 null
2 3 7 9 11 null
Output: 2
Write a program using Java to move the last element of a LL to the beginning of the list.
Using supply and demand diagrams, show the effect of the following events on the market for sweatshirts.
a. A drought in Egypt damages the cotton crop.
b. The price of leather jackets falls.
c. All universities require students to attend morning exercise classes in appropriate attire.
d. New knitting machines are invented
Write a Java program to find maximum product of two integers in a given array of integers.
Example:
Input :
nums = { 2, 3, 5, 7, -7, 5, 8, -5 }
Output:
Pair is (7, 8), Maximum Product: 56
Write a Java program to shuffle a given array of integers.
Write a Java program to form the largest number from a given list of non-negative integers.
Example:
Input :
nums = {1, 2, 3, 0, 4, 6}
Output:
Largest number using the given array numbers: 643210
Explain each of the following statements using supply and demand diagrams.
a. When there is a drought in southern Europe, the price of soft fruit rises in supermarkets throughout Europe.
b. When a report is published linking a product with an increased risk of cancer, the price of the product concerned tends to fall.
c. The United States announces that it intends to impose new sanctions on the Islamic Republic of Iran. The price of petrol in Europe rises and the price of a used Mercedes falls.
Write a Java program to rearrange a given array of unique elements such that every second element of the array is greater than its left and right elements.
Example:
Input :
nums= { 1, 2, 4, 9, 5, 3, 8, 7, 10, 12, 14 }
Output:
Array with every second element is greater than its left and right elements:
[1, 4, 2, 9, 3, 8, 5, 10, 7, 14, 12]