Abstract-As different students have different basics in learning CollegeComputer Basic Application Course, so uniform teaching methods and curriculum cannot satisfy the needs of all of the students. To address this problem, an algorithm of student clustering which can achieve hierarchical teaching is designed in this paper. After analyzing the disadvantages of slow convergence in the late processing and the local extreme of PSO, an improved Particle Swarm Optimization (i-PSO) algorithm based on granules and maximum distances is proposed. By adopting tactics of linearly decreasing weight and random distribution, adding the extremum disturbance operator, and optimizing the individual extremum of particles, the i-PSO algorithm can quickly converge to an optimal global solution�The i-PSO algorithm combined with the K-means algorithm can improve the poor clustering effect and instability of the Kmeans algorithm caused by random initial clustering center. Finally, the i-PSO and K-means algorithms are applied to the clustering. The results of simulation experiments show that this algorithm has higher accuracy, a faster convergence rate and greater stability, and can better help to realize layered teaching in College Computer Basic Application Course.