CSCI 2270 Computer Science 2: Data Structures
Fall 2003
Karl Winklmann

Solutions for final

Tuesday, December 15, 2003

 


Previous page | Latest page | Schedule and syllabus | Home Page | Programs | Table of contents | News archive | Dora

     
  1.        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);
           }
    
     
     
  2.  
     
  3. If the same 100 numbers are inserted into two heaps but in a different order, do we know that ...  
     
     
     
  4.     bool Node::binary ()
        {
            if (nChildren > 2)
                return false;
    
            for (int c = 0; c < nChildren; c++)
                if (!child->binary ())
                    return false;
    
            return true;
        }
    
     
     
  5. Note: This problem was not meant to be about "double hashing," in which case the answers change. But the problem statement did not say so, hence you get credit if your answers are correct for double hashing.

     


    © 2003 Karl Winklmann 3:08 PM, Tuesday, December 16, 2003