CSCI 2270
Computer Science 2:
Data Structures
Fall 2003
Karl Winklmann
Tuesday, December 15, 2003
bool Graph::sparse ()
{
int count = 0;
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
if (edges [i][j])
count++;
return (10*count < n*n);
}
bool Node::binary ()
{
if (nChildren > 2)
return false;
for (int c = 0; c < nChildren; c++)
if (!child->binary ())
return false;
return true;
}
| © 2003 Karl Winklmann | 3:08 PM, Tuesday, December 16, 2003 |