4 ms·
It's typically smaller though, not every phone number is allocated and many are in sequential groups. Some are special cased, you don't need to search any numbe
by RL_Quine 4y ago
It's typically smaller though, not every phone number is allocated and many are in sequential groups. Some are special cased, you don't need to search any number matching `****555***` in north america for example, which cuts down on the search space quite a bit.
- mrb 4y ago"Quite a bit"? Filtering out ***555**** removes only 0.1% of phone numbers ;)
- RL_Quine 4y agoThat's one example of an invalid range, not all of them. Lots of the area codes in north america just haven't been used for one reason or another.
- tomjakubowski 4y agoI didn't do the math here but: Filtering out 5*... would remove 10% of the search space. (dots mean "followed by more stars") Filtering out *5*... would remove 1%. So wouldn't ***555**** remove closer to 0.01%, not 0.1%?
- 8organicbits 4y agoTry the math, this is a good problem to work through. The position of the 5 doesn't impact the search space like that. 10% of the 10 digit numbers start with a 5. 10% of the 10 digit numbers end with a 5. 5... in your example shouldn't be 1%.