The basic algorithm and data structure and their implementation