| changeset 558 | c9da2c4586f2 |
| parent 474 | 331b2c9e525f |
| child 563 | 6bb70f562d37 |
| 557:6d0e8b6f4243 | 558:c9da2c4586f2 |
|---|---|
1 # A case of catastrophic backtracking in Ruby |
|
2 #--------------------------------------------- |
|
3 # |
|
4 # regex: (a?){n} a{n} |
|
5 # strings: aa... |
|
6 # |
|
1 # example provided by Daniel Baldwin |
7 # example provided by Daniel Baldwin |
8 # |
|
9 # call with: |
|
10 # |
|
11 # > ruby catastrophic.rb |
|
12 # |
|
2 |
13 |
3 nums = (1..1000) |
14 nums = (1..1000) |
4 |
15 |
5 #iterate through the nums 1-1000 |
16 #iterate through the nums 1-1000 |
6 nums.each do |i| |
17 nums.each do |i| |