3道经典面试题
A. Given a link list of integers, write a procedure PrintReverse() to print out the integers in reverse order. e.g. if mylist is 3, 6, 2, then PrintReverse(mylist) would print out 2 6 3.
Notes:
1. please handle all special cases
2. mylist has to be the same as before after PrintReverse() has run.
typedef struct node
{
int x;
struct node* next;
} Node;
void PrintReverse(Node* mylist)
{
…. Your code goes here …
}
B. What is the time complexity of your procedure?
C. What is the space complexity of your procedure?