CIT594 Final Exam
Spring 2007
Name_________________________________________

Please keep all your answers short and to the point. Do not provide extra information that was not asked for.

  1. True or false?
    1. _____ The Set interface extends the Collection interface.
    2. _____ The following is legal: List<String> list = new List<String>();
    3. _____ When doing a tree search, when we detect a nonpromising node, we can prune (ignore) the entire subtree rooted at that node.
    4. _____ If two algorithms have the same Big-O running time, they are equally fast.
    5. _____ Quicksort is always O(n log n).
    6. _____ A linked list is a good data structure to use when you expect to do frequent binary searchs on the collection.
    7. _____ Information is persistent if it is kept between one invocation of a program and the next
    8. _____Genetic algorithms work better with asexual, rather than sexual, reproduction.
    9. _____State-space searches should be designed with as many operators as possible.
    10. _____Breadth-first searches usually require more memory than depth-first searches.

  2. Tell the Big-O running time for all of the following:

    1. __________ Binary search (when unsuccessful)

    2. __________ Heapsort

    3. __________ Creation of a Huffman tree

    4. __________ A problem classified as "intractable"

  3. Fill in the blanks
    1. A ___________________ algorithm is effectively a depth-first search on a virtual tree.
    2. A ___________________ algorithm can be characterized by "do what is best in the short term, and hope the long term works out."
    3. ___________________ is a regular expression that will match two digits in a row.
    4. Java is compiled into ___________________, which is intermediate between Java and a “real” assembly language.
    5. A ___________________ algorithm type uses at least two recursive calls at each level.
    6. A ___________________ is a collection of zero or more graphs, but with many fewer restrictions than usual for graphs.
    7. It's usually a good idea to put the word ___________________ in front of Random random = new Random().
    8. If you override hashCode(), you must also override _____________________.
    9. If an undirected graph has N nodes and E edges, there are_____________ nodes and _____________ edges in a spanning tree of that graph.
    10. Freeing storage while it is still in use results in a ___________________ error.
    11. Failing to free storage that can no longer be accessed results in a ___________________.
    12. "PBV" stands for ________________________________________.
    13. ____________________ and ____________________ are two classes that implement the Map interface.
    14. A simple Preferences object behaves like a ___________________.
      n

  4. How would you characterize the "sum of subsets" problem as a state space search?






  5. In the A* algorithm formula f(N) = g(N) + h(N), what are N, g, h, and f?






  6. What is the purpose of "regression testing."?



  7. Why is Kruskal's algorithm much harder to implement efficiently than Prim's algorithm?




  8. When doing an alpha-beta search, tell one of the assumptions you are making.



  9. Given a complexity function f(n), give informal definitions for:
  10. What is a "JIT" compiler?



  11. Describe the tests you would write for a random number generator that produces random numbers from 0 to 500.







  12. Why can entropy be thought of as a measure of surprise?



  13. Write code to print out the contents of a Map named myMap, one entry per line, as
    key = value.






  14. Given the following characters (see table) and their frequencies:
    1. Tell how many bits would be required for each character in a fixed-width encoding.
           

    2. Construct a Huffman tree for the characters in the space provided.

    3. Show the Huffman encoding for each character in the space provided.

    4. Use your encoding to encode the message AABCDAE


    Construct
    your tree
    in the
    area on
    the right:





     
    Frequency:
    15%
    15%
    25%
    10%
    35%
    Character:
    A
    B
    C
    D
    E
    Encoding:

  15. What kind of syntax rule is completely impossible to describe in BNF?





  16. What two pieces of information does Java keep about each array?




  17. Given the following binary tree, should the intrepreter evaluate the nodes in preorder, postorder, or inorder? Explain and write the order in which the nodes are visited based on your answer :



  18. What characteristics of a problem would suggest that backtracking is a good approach to solving that problem?



  19. How would you implement a sparse two-dimensional array using a hash map (or a small number of hash maps)?




  20. Name two main techniques for doing garbage collection, and mention one disadvantage of each technique.



  21. In the following game tree, it is your turn to move. Fill in the backed-up values and indicate what moves will be made. Indicate where any alpha cutoffs will occur.

  22. You are running an online dating service. An equal number of girls and boys have signed up. Each girl has rated each boy (on a scale of 0 to 100), and each boy has rated each girl, according how much they would like to date that person. Your job is to arrange dates for everyone for next Saturday.

    Describe a greedy algorithm for arranging dates.








  23. What does the javap command do?



  24. If a Plex implements a node in a regular (non-hyper) graph, what are the contents of each field of that Plex?