Lyapunov exponent is a significant symbol to identify the nonlinear dynamic characteristics of the system. However, most of algorithms are not universal enough and complex. According to the classic Lyapunov exponent algorithm and perturbation theory, in this paper we propose a new algorithm which can be used to compute Lyapunov exponents for discontinuous systems. Firstly, the initial value of the system state parameter and the disturbance of each basic vector along the phase space are taken as initial conditions to determine the phase trajectory. Secondly, the method of difference quotient approximate derivative is adopted to obtain the Jacobi matrix. Thirdly, the eigenvalues of the Jacobi matrix are calculated to obtain the Lyapunov exponent spectrum of the system. Finally, the algorithm in a two-degree-of-freedom system with impacts and friction is used, showing its effectiveness and correctness by comparing its results with the counterparts from the synchronization method. The algorithm can not only be used for discrete systems and continuous-time dynamic systems, but also quickly calculate the Lyapunov exponent of complex discontinuous systems, which provides a new idea for determining the dynamic behavior of complex discontinuous systems.