Assignment 1, due Jan 24

Part of the homework for 22C:60 (CS:2630), Spring 2014
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

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 (usually Friday). 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!

    Homework questions based on prerequisite material:

  1. Background: Consider this recursive function, expressed informally:
    function f( i ) -- i is positive integer parameter
                    -- the return value is a character string
       r = i mod 10
       q = i / 10   -- r and q are the integer remainder and quotient
       if q > 0
          return f(q) concatenated with the character '0'+r
       else
          return '0'+r -- a single character
    

    Problem: What is the falue of f(1024). (1 point)

  2. Background: Here is a fragment of informal (not a real programming language) code:
        a = head
        while a.value < b.value do a = a.next
        b.next = a.next
        a.next = b
    

    A Question: The above code inserts items into a data structure. In English, this description has a very simple description. (as in "a lexicographic binary tree" or "an unsorted doubly-linked list", neither of which applies in this case.) What is the simple description? (1 point)

    Homework questions based Chapter 2 of the text:

  3. A Problem: Give the 7-bit ASCII representation of the text "Jan. 24, 2014" Don't include the quotes. Give your result as a column of binary numbers, one per character. (1 point)