Homework 2

[Note: this webpage last modified Friday, 04-Feb-2011 19:44:51 EST]

This homework assignment is due before class starts on Tuesday, January 25. Your solutions should be explained in complete sentences such that your classmates will understand the solution (and can verify your proofs are correct) even if they have not solved the problems themselves.

  1. HW Polices.

    1. Type your HW (in word, latex, text file, etc.) and send to me by email.

    2. Do NOT share electronically. You must type your own solutions. You can discuss the problems with each other, but you may only discuss them. You may not write out solutions together.

    3. You MAY NOT search the Internet, textbooks, etc. for solutions to the problems. The following are the ONLY sources of information that you may use in solving the problems: the textbook for this course and assigned reading, and wikipedia articles on basic math/probability/CS/etc.. You may discuss the problems with each other and with myself, but must obey the previous item in doing so.

      If you do find the solution in one of these sources, you still MUST cite the source in your document.

      You may use NOTHING ELSE that is online or other textbooks.

    4. You MAY NOT copy word-for-word from any source, even the sourcesyou are allowed to consult. If you feel it is necessary, you should put the quotation in quotes and provide a reference/citation.

  2. (-3 points if left blank) List who you collaborated with on this assignment, "none" if none.

  3. (5 Points, assigned by Kartheek) Choose your favorite programming language and write a function to take a string as input and break it up into a list of words (each word is separated by a space). Your function should return/print a list of the words. For example, "first word is blah, second word is blahblah". This basic parsing of a string into words is part of what would go into a command interpreter.

    You should include your program/code as a separate attachment to your email so that I can download it and compile it without having to copy and paste or anything like that. Even if there is a builtin function that will do this for you (for example, there is a function called split in Python), you should not use that. You should write the function yourself.

  4. (5 Points, assigned by Abhinav) Consider the following relational schema:
    employee (person_name, street, city)
    works ( person_name, company_name, salary)
    company ( company_name, city)
    manages ( person_name, manager_name)

    For each part write relational algebra for the query. (a)Find the names of all employees working for ISU. (b)Find all the cities where employees managed by Alice live.

    For each part write SQL for the query. (c)Alice is an employee. Find the name of her manager. (d)Alice is a manager. Find the names of employees managed by her that earn at least one tenth of what she earns.