equal
deleted
inserted
replaced
1 # A case of catastrophic backtracking in Ruby |
1 # A case of catastrophic backtracking in Ruby |
2 #--------------------------------------------- |
2 #--------------------------------------------- |
|
3 # example provided by Daniel Baldwin |
3 # |
4 # |
|
5 # |
4 # regex: (a?){n} a{n} |
6 # regex: (a?){n} a{n} |
5 # strings: aa... |
7 # strings: aa... |
6 # |
8 # |
7 # example provided by Daniel Baldwin |
9 # run on the command line with: |
8 # |
10 # |
9 # call with: |
11 # $> ruby catastrophic.rb |
10 # |
|
11 # > ruby catastrophic.rb |
|
12 # |
12 # |
13 |
13 |
14 nums = (1..1000) |
14 nums = (1..1000) |
15 |
15 |
16 #iterate through the nums 1-1000 |
16 #iterate through the nums 1-1000 |