CSSE 120 — Introduction to Software Development

Homework 26

Do the following exercises. For problems 4 and following, use today's homework project: Session26_ArraysHousePrices

  1. You might want to reexamine the Python vs C comparison document.
    • You may find this helpful as you try to do things in C that you already know how to do in Python.
    • Feel free to suggest things that we might add to this document.
  2. Complete the assigned reading for the next session listed on the schedule page.
  3. (10 points) Complete the ANGEL quiz over this reading, at the course ANGEL page, under Lessons → Homework → Homework 26 → Quiz 26: Strings and Chars .
  4. (35 points total below)

    • Background: For this exercise we are interested in using arrays to help us study the prices of 4-bedroom houses in Vigo County. In particular, we would like to know the

      • mean (i.e., average) price,
      • median price,
      • 5 highest prices, and
      • 5 lowest prices
      of 4-bedroom homes in Vigo county.

      We will guide you in helping us to do this study by specifying functions that you will implement and test, culminating in a function that outputs the above statistics on actual data from 2007.

    • Where the data comes from: To see data like that which we will give below, point your browser to http://www.trulia.com/home_prices/Indiana/. Then:
      • Click on the Vigo County link on the Indiana map, then on the link for "Homes for sale in Vigo County".
      • You should see a a list of homes for sale that you can sort by address, price, type, beds, baths or broker. For example, sort by Bedrooms. You should see several pages of listings (with up to 15 listings on each page).

      You don't need to do anything with this data for the homework, but we wanted to show you how the data could be acquired.

    • To do the assignment, simply work through the TODO's in the file, in the order that they are numbered (TODO #1, TODO #2, ...). Three comments:

      • As part of your work you will implement a sort function. You might want to take a look at Wikipedia's article on Sorting Algorithms, just to see how many different sorting algorithms are known, each with its own particular virtues. (Wikipedia lists over 30 well-known sorting algorithms.)
      • At the END of the assignment, you will implement a doItAll function which uses the other functions you wrote to provide the above statistics on actual data from 2007. (We typed the data into the project for you.)
      • The points for this problem are distributed as follows: sort is 10 points, and each of the functions that follows sort (namely, findMean, findMedian, printNLowestPrices, printNHighestPrices, and doItAll) are 5 points each. The other code that you write is necessary to succeed at these graded functions, but the other code will not be explicitly graded.

      As usual, submit your code by committing the final version to your Subversion repository.

    • (5 points) Now that you have gained experience programming with Python lists and C arrays, we're asking you to compare them. Answer the following two questions in the file listArrayComparison.txt found in your project:

      Suppose you are asked by a company that processes terabytes of data to use either Python lists or C arrays to help them process their data.

      1. (2 points) Which of these two data structures is it easier for you to work with as a programmer? Why?
      2. (3 points) Now assume that you need the results quickly, that is, efficiency is a concern. Which data structure should you use? Why?

      Don't forget to SAVE and COMMIT the above file after putting your answers in it.