Assignment 1, due Jun 12
Part of
the homework for CS:2630, Summer 2018
|
On every assignment, write your name legibly as it appears on your University ID card! Homework is due on paper at the start of class on the day indicated (Tuesday or Thursday). Exceptions will be made only by advance arrangement (excepting "acts of God"). Late work must be turned in to the TA's mailbox (ask the CS receptionist in 14 MLH for help). Never push homework under someone's door!
function f( i, j ) if i = 0 return j else return f( j, i-1 ) + 1
a)
What is the value of f(1,1)?
(0.2 point)
b)
What is the value of f(2,3)?
(0.2 point)
c)
What is the value of f(5,8)?
(0.2 point)
d)
What is the value of f(13,21)?
(0.2 point)
e)
Give a short (20 words suffice) intuitive description of what this
function does, not how it does it.
(Hint: Ignore the code, look at your answers to parts a to e.)
(0.2 point)
operation o(x,y) -- neither x nor y may be null temp = x.next x.next = y y.next = temp y.back = x temp.back = y
A Question: This code performs an elementary operation on a common data structure. Name that operaton and name the data structure. (A 5 to 10 word answer will suffice.) (0.5 points)
a) Convert this to binary using the pen and paper method shown in Chapter 2. Show your work! (0.4 points)
b) Convert your answer from part A to hexadecimal. (0.4 points)
You can check your work in the above conversion problems by using any binary-hex-decimal conversion calculator, but you will be expected to be able to do such conversions by hand.