Serving customers algorithm Well I have a problem with a Christmas assignment and my teacher is not responding(maybe he is skiing somewhere now) so I will need some help.
The algorithm is about an office and the waiting time of the customers. We have one office that has to serve $n$ customers $a_1, a_2,\cdots ,a_n$. We assume that serving time $t(a_j)$ for  each customer $a_j$ is known. Let $a_j$ to be served after $k$ customers $a_{i_{1}},a_{i_{2}},\cdots ,a_{i_{k}}$.  His waiting time $T(a_j)$ is equal to 
$$T(a_j) = t(a_{i_{1}})+t(a_{i_{2}})+\cdots +t(a_{i_{k}})+t(a_{j})$$ 
I want to an efficient algorithm that will compute the best way to serve in order to reduce the total waiting time.
$$\sum_{j=1}^nT(a_j)$$
My first thought is that the customers with the smallest serving time have to go first and the obvious solution is apply a sorting algorithm. 
Am I wrong?

Problems of this kind belong to the area of operations research known as scheduling problems (scheduling theory). Here is a short bibliography of books that deal with this topic: http://www.york.cuny.edu/~malk/biblio/scheduling2-biblio.html There is a lot of nice mathematics involved.
