Google Interview Question

First question is to write a sort function, i wrote bubble sort, next is sort linked-lists. I'v tried to write a right version, but the interviewer wants me to optimize it. The final answer is "you can pre calculate the length of the linked-list". The questions are easy, but hard to tell if it's good for selecting programmers.