push 1; push 5; push 3; pop; push 4; push 2; pop; pop; pop; pop; |
What sequence of numbers will be generated by the pop commands?
enqueue 1; enqueue 5; enqueue 3; dequeue; enqueue 4; enqueue 2; dequeue; dequeue; dequeue; dequeue; |
What sequence of numbers will be generated by the dequeue commands?
void insertData(NodeT *head, int v) { // create new node and set data NodeT *new = (NodeT *)malloc(sizeof(NodeT)); assert (new != NULL); new->data = v; new->next = head; } |
Assume that we have a sequence of characters.
Assume the character string is stored in a linked list, one character in each node. Think of 2 different strategies to implement left and right rotation of a string stored in a linked list. Both strategies will require you to traverse the entire linked list:
Suppose we are given a sorted linked list of numbers. We are interested in knowing whether there are any duplicate nodes (i.e. nodes that have the same data) in the list.
int hasDupList(NodeT *); // 1 if true, 0 if false |