INFM 603
Information Technology and Organizational Context
Spring 2015
Assignment H4


In this assignment we'll get a bit more complex, both with the implementation and with the algorithm. The algorithm we will use is the binary search, which we looked at two ways of doing in class (either with a loop or using recursion). Unless you have a particular interest in recursion, I would recommend using a loop. But you can use either one. The implementation complexity is that the way you will implement this will require you to use at least one function, so you'll gain some experience with that. We don't really care about the task (involving SKU's) -- that's just something that gives us a real problem to work on. Indeed, we don't really care about binary search in particular -- we are more interested in the idea of how a rather abstract algorithm like that is translated into a computer program. Binary search is just a convenient algorithm to focus on because it is complex enough to call for some abstract thinking. So although you could solve this problem easily in some simpler way, don't do that -- implement a binary search.

  1. Create a Web page that uses a binary search to search a list of 10 integer Stock-Keeping Unit numbers (SKU's) for items that are in stock. If the entered number is found, the page should display a message indicating that the item is available. If not, it should display the closest available stock numbers with numbers below and above the entered number. The search function must implement a binary search (looking at every number is not allowed because we want to demonstrate a technique that could be efficiently scaled up to a million items). The SKU's that the system searches should be 357, 401, 14, 522, 399, 1, 514, 1023, 711, and 515.
  2. Call your Web page hw4.html, place it in the usual (603) directory on TerpConnect and link it from index.html as usual.

Doug Oard
Last modified: Wed Jan 14 20:35:19 2015