Questions: 5 831

Answers by our Experts: 5 728

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

How to concatenate float and string

You are required to implement a simple equation stored in a binary tree.




Each operand or operator should be stored as a tuple of the form (TYPE, VALUE).



Your task is to complete the body of the functions, insert and evaluate.



The parameter data will be used to store the tuple (e.g. (OPERAND,34)



bracketed in the insert function is used to denote whether an operator is



The evaluate function should be able to process the expression stored in the binary tree and compute the final result.To do that,the function should be able to traverse the binary tree. Observe how the evaluate function is used inside the get ouput.



the expression stored in the binary tree is“1+(2*3)+3^ 2"



the evaluate function should return 100.



The get_output function returns the final result




function) if it is in the range [0, 999]. If the final result is less than 0, it returns




UNDERFLOW and if the final result is greater than 999, it returns OVERFLOW.

Write a program For example, if the given numbers are M is 4 and N is 16, the perfect squares from 4 to 16 are 4(2 * 2), 9(3 * 3), and 16(4 * 4), as the first perfect square is 4. So the output should be 4.


Else print No perfect Square

Add two polynomials


Given two polynomials A and B, write a program that adds the given two polynomials A and B.


Input



The first line contains a single integer M.


Next M lines contain two integers Pi, Ci separated with space, where Pi denotes power and Ci denotes co-efficient of Pi for polynomial A.


After that next line contains a single integer N.


Next N lines contain two integers Pj, Cj separated with space, where Pj denotes power and Cj denotes co-efficient of Pj for polynomial B.


Output



Explanation



If M = 4 and for polynomial A


For power 0, co-efficient is 5


For power 1, co-efficient is 0


For power 2, co-efficient is 10


For power 3, co-efficient is 6.



If N = 3 and for polynomial B


For power 0, co-efficient is 1


For power 1, co-efficient is 2


For power 2, co-efficient is 4.


Then polynomial A represents "6x^3 + 10x^2 + 5", the polynomial B represents "4x^2 + 2x + 1" and the addition of A and B is "6x^3 + 14x^2 + 2x + 6"

4.4 Write a program which reads the social security number SOC of a student and uses LINEAR to find and print the student's record. Test the program using (a) 174-58-0732, (b) 172-55 5554 and (c) 126-63-6382.


IPL Match Details



Write a program that reads all the match outcomes and summarizes the information of all the matches.


Points are given to the terms based on the outcome of the match.


A win earns a team 3 points.A draw earns 1.A loss earns 0.


The following information is expected:


MP:Matches Played


W:Matches Won


D:Matches Drawn(Tied)


L:Matches Lost


P:Points



The team information should be displayed in descending order of points.



Sample input 1


6


CSK;RR;loss


RR;DD;draw


MI;KKR;win


KKR;RR;loss


CSK;DD;draw


MI;DD; draw



Sample output 1


Team: RR, Matches Played: 3, Won: 2, Lost: 0, Draw: 1, Points: 7


Team: MI, Matches Played: 2, Won: 1, Lost: 0, Draw: 1, Points: 4


Team: DD, Matches Played: 3, Won: 0, Lost: 0, Draw: 3, Points: 3


Team: CSK, Matches Played: 2, Won: 0, Lost: 1, Draw: 1, Points: 1


Team: KKR, Matches Played: 2, Won: 0, Lost: 2, Draw: 0, Points: 0

4.1 Write a program for each of the following:


(a) Listing all students whose CUM is K or higher. (Test the program using K = 3.00.)


(b) Listing all students in year L. (Test the program using L= 2, or sophomore.


Add two Polynomials



Given two Polynomials A and B,write a program that adds the given two Polynomials A and B.



Sample input 1


4


0 5


1 0


2 10


3 6



Sample Output 1





Sample Input 2


4


0 5


1 0


2 10


3 6


3


0 1


1 2


2 4



Sample output 2


6x^3 + 14x^2 + 2x + 6

Polynomial



Given polynomial,write a program that prints polynomial in Cix^Pi + Ci-1x^Pi-1+....+C1x+C0 format.



Input



The first line contains a single Integer N.


Next N lines contain two integers Pi,Ci separated with space, where Pi denotes power and Ci denotes coefficient of Pi.



Sample Input 1


5


0 2


1 3


2 1


4 7



Sample output 1


7x^4 + 6x^3 + x^2 + 3x + 2



Sample input 2


4


0 5


1 0


2 10


3 6



Sample output 2


6x^3 + 10x^2 + 5

Write a program which takes 5 inputs from user for different subject’s marks, total it and generate mark sheet using grades ? 


LATEST TUTORIALS
APPROVED BY CLIENTS