algorithm ch18 examples