Programming Assignment 6 - Backbone Routing

Introduction to Computer Science II, Summer 2001


Table of Contents

Due Date

This assignment is due on Tuesday, 14 August, no later than 2:00 p.m.. This deadline is hard; you must submit your assignment by the deadline or it won't be accepted.

See the assignment turn-in page for instructions on turning in your assignment.

Background

A nation-wide Internet service provider (ISP) has a backbone network consisting of several network segments. Each network segment is named after the city hosting that part of the segment; for example, there are segments named Red Bank, Joplin, and Denver.

Each network segment consists of one or more routers. Each router has a name of the form Ri where i is a sequence of one or more decimal digits; for example, R0001 and R3453333 are router names. Each router on a network segment has a name unique within that segment, but router names may be repeated among network segments; for example the router R0101 may appear in both the Terra Haute and Walla Walla subnets, but within each subnet there is only one router named R0101.

Every three days the ISP's nationwide network operations center gathers traffic statistics from each of its network segments and recomputes new routing tables based on the collected traffic statistics. The routing-table generator creates a single file named routing-tables consisting of zero or more records, where each record has the following format:

segment-name router-name router-table
where

Within a record, each field is separated from the other by a white-space character; any white-space character may be used (the white-space characters are space, tab, or newline).

Each record immediately follows the next; there are no white-space characters separating one record from another. Records appear in arbitrary order in the generated file.

Problem

Write a program that reads the file created by the routing-table generator and creates a separate file for each network segment given in the data file. All network-segment files have the same format, which is a sequence of one or more records, each record having the format
router-name byte-count router-table
where

A single space character ' ' separates one field from the next; no characters separate one record from the rest. Records in a network-segment file are stored in ascending order by router name; use the order operators defined for the string class to determine order.

The name of a network-segment file is based on the name of the network segment with the following changes:

For example, the network segment San Francisco has san-francisco.rt as the name of its network-segment file.

Testing

There are two sets of data files you can use to test your program; one set ends in -1 and the other set ends in -2. You will have to rename the input files to use them with your program. You can find the files at

/export/home/us/csfac/cs176-summer2001/pa/6

from any PC lab machine running linux or rockhopper.


This page last modified on 1 August 2001.