Provide two implementations of Multi-threadng, (One uses inheritance and the other uses interface) for the following tasks: (Use Synchronized blocks to prevent mutual exclusion violation)
i) Concurrently find and calculate the highest number in an integer array called myNumbers.
ii) Update the value to a variable called highestNumber.
interface Queue {
void Enqueue(int n);
int Dequeue();
int length();
}
interface Stack {
void Push(int n);
int Pop();
int length();
}
Given the following interfaces for Stacks and Queues, implement each interface in two ways: using a Linked-List and a Stack. (That means, a total of FOUR implementations is needed. E.g., Queue using Linked-List & Queue using Growable Array. Provide a short paragraph of your observation once you have completed all the implementation. Use the folllowing names MyStack1, MyStack2, MyQueue1, MyQueue2 in your code.
Briefly describe which part of code change is needed so that your implementations in Part B can accommodate and type of objects. Meaning: It can store type of objects. Provide at least two lines of code that shows how the container gets instantiated and how an object can be stored inside your container.