Linear time small coresets for k-mean clustering of segments with applications