sample algorighms implementation