Correlation functions of the KdV hierarchy and applications to intersection numbers over M¯g,n