Pre-lab 6 questions
Name:
Cnet ID:
Lab start time:

Note: This week, it is free response rather than multiple choice
1. How is a tree different from a linked list?







2. What are the two properties that define a binary search tree?







Tagged unions are one way of allowing the same data structure to hold related items at the same time. This is not for code reuse. Rather, it is so that, for example, a queue can be used to do FIFO across both of them. If we needed to maintain two different queues, the order between the two queues would be lost. Conversely, void pointers with function pointers is a way to implement code reuse. You can declare two linked list variables, and one linked list can store one type, whereas the other linked list stores another type. If these are sorted in any way, then you need a function that compares the two items since the linked list code is not aware of the details of the items. What is the signature for such a function?
      a) void compare(int x, int y);
      b) int compare(void x, void y);
      c) int compare(void *x, void *y);
      d) void *compare(void *x, void *y);
      d) bool compare(void *x, void *y);
      e) bool compare(void x, void y);
      f) bool compare(int x, int y);