Implementing and testing classical Algorithm