[algorithms][distance] follow coding guidelines regarding "if (expr)" statements