An algorithm for solving the inverse kinematic problem of traveltime seismic tomography is developed and tested. The algorithm is intended for imaging the three-dimensional (3D) velocity model composed of a layer underlain by a half-space. This algorithm considers the bottom boundary of the layer as a first-order seismic velocity discontinuity with unknown position that has to be determined in the inversion together with the velocity variations inside the overlying layer and the sub-interface boundary velocities. The inversion can be applied to the travel times of refracted, head and reflected waves. The main idea behind the algorithm is the adaptive parameterization of the medium by the sparse Haar wavelet series expansion. In order to throw off the poorly resolved coefficients of expansion, we suggest using two empirical local resolution measures: the number of seismic rays crossing the support of the corresponding wavelet support area and their angular coverage, i.e., the spread in the azimuths of these rays. The adequacy of these measures is tested by their comparison with the estimation of the diagonal elements of the resolution matrix on the synthetic examples. This comparison proved that the proposed measures can be successfully applied for statistical estimation of the resolution and for constructing the adaptive parameterization. It was shown also that the best results are achieved while using the number of rays normalized to the size of the wavelet support together with their angular coverage. An automated procedure for throwing off poorly resolved unknowns is developed. The parameters of this procedure can be tuned to provide the desired level of detail of the model to be reconstructed. The synthetic checkerboard testing proved the efficiency of the algorithm. The proposed algorithm can be applied to solve different types of problems, including regional seismic studies, as well as exploration and engineering seismology. The use of this algorithm is especially convenient when the medium is essentially three-dimensional and when the conventional seismic methods implying regular network measurements directly above the studied structure (such as the common depth point method) are inapplicable, e.g., in the seismic studies of the foundations of buildings and in rugged terrains.