A little warm-up for your test tomorrow.


R. Clayton (rclayton@monmouth.edu)
(no date)


I wrote this code

  static unsigned
  find_outer_edge(const edge_list & edges) {

    // Return the index of an edge belonging to an odd number of shreds, or
    // return 0 if no such edge exists.

    for (unsigned i = 0; i < edges.edge_count() - 1; i++)
      if (odd(edges.shred_count(i)))
        return i;

    return 0;
    }

for another class I'm teaching this semester. Unfortunately, this code blows
up in one particular circumstance (I'm so embarrassed). What is the
circumstance and why does the code blow up?

Here's a hint: edge_count() returns an unsigned integer.



This archive was generated by hypermail 2.0b3 on Mon Dec 15 2003 - 19:45:05 EST