Q1: A. Assume that each of the expressions in the following table has processing time T(n) to solve a problem of size n. Identify the dominant term(s) having the growing increase in n and specify the Big-Oh complexity. B. Find the Big-Oh for each of the following programs.
Q2: Both ArrayList and LinkedList are inefficient for searches, take linear time. Explain why this occurs in these data structures
Q3: Write a Java program using Stack class to demonstrate the following activities:
Create three empty stacks named stack1, stack2 and stack3 respectively.
Print the largest number in stack3
2-Push the numbers [6,4,9] into stack1 and [1,2,3] into stack2.
3-Pop the top number of stack1 and top number of stack2 and multiply them. Then, push the multiplication result into stack3.
4-Pop the top number of stack1 and top number of stack2 and divide them. Push the result of division into stack3.
5-Print Stack1, stack2 and stack3.
[Note: Provide a screenshot of the code output].
Q4:Write a java program to create a linked list named “grades” with four elements: “Second grade”, “Third grade”, “Fourth grade”, and “Sixth grade”.
Then do the following activity and provide a screenshot of the code result.
1-Add a new element “First grade” at the beginning of the linked list using iterator.
Add a new element “Fifth grade” after the element “Fourth grade” using iterator.
Print the LinkedList backward from the last element to the first element using hasPrevious()
For This or a Similar Paper Click Here To Order Now