Question
5) A polynomial 'p' may be represented as a list of integers in an array as follows: for every term in 'p', there is one
5) A polynomial 'p' may be represented as a list of integers in an array as follows:
for every term in 'p', there is one entry in the array, consisting of the term's coefficient stored at the index that corresponds with its degree. The entries are ordered according to values of degrees; zero-coefficient terms are stored as 0.
a)Draw the array and show how the following polynomial is stored in the array. 3x6 -4x4 +x3 -2x2+6x1 2x0 (x0 ==1)
b) Propose an algorithm that adds two polynomials and produce the resulting polynomial based on the above array representation given above.
( Here is a second polynomial 2x5 + 4x3 + 5x2 - 2x1 )
6) Given a linked list, one can reverse the list using a Stack. Assuming that Java API LinkedList and Stack are available for you, write Java code(NOT pseudo-code) to accomplish this task. You must show the construction of input list using several integers. The output of your solution should be a LinkedList.
4) Given a singly linked list with only the head reference, one can reverse the list using a Stack. Provide a detail algorithm to accomplish this reversal. The final outcome is a linked list.
6) Given a linked list, one can reverse the list using a Stack. Assuming that Java API LinkedList and Stack are available for you, write Java code(NOT pseudo-code) to accomplish this task. You must show the construction of input list using several integers. The output of your solution should be a LinkedList.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started