Similar Items: Rule-Based Graph Programs Matching the Time Complexity of Imperative Algorithms