1(a) Convert the floating point number-25.16 ?nto its binary representation with
ID: 3705424 • Letter: 1
Question
1(a) Convert the floating point number-25.16 ?nto its binary representation with a 12 bit mantissa and a 4 bit exponent, with the hidden bit in the mantissa and a bias of 7 in (5 marks) Provide the mathematical expression (in infix form) represented by the the exponent. (b following postfix string 7 16 5 24 3 + (ii) Trace through the stack-based algorithm step by step in the evaluation of the above postfix string. (6 marks) (c) State a data structure that is suitable for storing (i) (ii) the words in a dictionary to facilitate searching. the set of folders you have in your computer. Explain your c hoices (5 marks) ??? + B2P + Bri + Bo is defined by the following end conditions: -Pm, P(1) -Pi and P'(1) P1', where Po, Pm, Pi and P1' are (d) A cubic curve P(t) P(0) - Po, P(0.5) known values. Derive the equation of the curve in terms of these values. What is the condition for two such curves to be C continuous? (7 marks)Explanation / Answer
Please find the answers to questions below :
2) i) 7+(((16+5)*2)/(4+3))
ii) The postfix to infix conversion can be done using a stack.
1.1 Read the next symbol from the input.
2.If the symbol is an operand
…2.1 Push it onto the stack.
3.Otherwise,
…3.1 the symbol is an operator.
…3.2 Pop the top 2 values from the stack.
…3.3 Put the operator, with the values as arguments and form a string.
…3.4 Push the resulted string back to stack.
4.If there is only one value in the stack
…4.1 That value in the stack is the desired infix string.
Using the above algorithm, the infix expression for the above given postfix expression is :
i/p Stack
7 7
16 7,16
5 7,16,5
+ 7,16,5,+
2 7,(16+5),2
* 7,(16+5),2,*
4 7,((16+5)*2),4
3 7,((16+5)*2),4,3
+ 7,((16+5)*2),4,3,+
/ 7,((16+5)*2),(4+3),/
+ 7,(((16+5)*2)/(4+3)),+
Finally : (7+(((16+5)*2)/(4+3)))
3 ) i) A dictionary has alphabetically ordered words. Hence a Trie data structure would be most suitable for searching the words in a dictionary. In a trie, the complexity is O(h) where h is the height of the trie. This does not consume a lot of excess space as well.
3) ii) The set of folders in a computer can be represented using a tree. This is because there is no certain order among the folders of a computer and the user is free to sort to on the basis of size, name, date accessed etc.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.