Aspects


vs


Backtracking

Backtracking is a general algorithm for finding solutions to some computational problem, that incrementally builds candidates to the solutions.

Greedy

A greedy algorithm is an algorithm that follows the problem solving heuristic of making the locally optimal choice at each stage with the hope of finding a global optimum.

Others

Quality Example
Steps much fewer

"Since the next is not far the number of backtracking steps is much fewer than with greedy matching"

from question "Can I improve performance of this regular expression further"

Less

"The capturing group 1 in the first pattern is greedy it first matches everything and takes as less as it backtracking"

from question "Confusion in RegExp Reluctant quantifier? Java"

Back to Home
Data comes from Stack Exchange with CC-BY-SA-3.0