All questions are programming questions. You're asked to write code on a whiteboard that is pretty close to functioning. I was given five questions throughout the day, but I'll only ask the ones that weren't completely mundane (they're all straightforward).
1. Write a method to draw a tree given the following definition of a tree:
typedef struct _TreeNode
{
TreeNode *firstChild;
TreeLink *children;
void *data;
} TreeNode;
typedef struct _TreeLink
{
TreeNode *child;
TreeLink *nextChild;
} TreeLink;
And the following method that renders a node on the screen at position (x,y). You can assume an infinite canvas, and it doesn't matter where the tree is positioned, as long as the nodes are given a "spacer" of 1 unit (each node occupies 1sq unit).
void *DrawNode(TreeNode *node, float x, float y);
2. Given two pointers to arbitrary nodes in a tree, write a method that finds their first common ancestor. You can assume the tree is balanced.
3. Write some C code to parse an INI file.
4. You're tasked with writing the history functionality for a browser. You're primarily concerned with returning all entries that start with some substring. What data structures would you use to store the history?