You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
Required fields*
- 
        Ah, cool. I didn't know about O(infinite) so wasn't sure what to use. The checking could be constant time though so O(n) is best case. :-) thanksFogmeister– Fogmeister2015-05-14 09:24:30 +00:00Commented May 14, 2015 at 9:24
- 
        2This answer doesn't seem to take likelihood into account. Maybe infinite time is possible, but extremely unlikely. If you analyze randomized algorithms normally you must take the likelihood into account. For example, if you've got an algorithm with an infinite-time case, but this case only happens 0.00001% of the time, maybe that's acceptable for an application. Then you've also got to consider the security and quality of the random number generation - can an adversary an discover which particular case results in you doing infinite work?Brandin– Brandin2015-05-14 09:26:37 +00:00Commented May 14, 2015 at 9:26
- 
        @Brandin the worst case is you keep picking random numbers such that they've already been selected previously. Some seeds for prngs may be shorter than expected. If you have such a situation and have already generated all the numbers in the period, you will encounter O(∞) on the next iteration.user40980– user409802015-05-14 13:38:51 +00:00Commented May 14, 2015 at 13:38
- 
        1@Brandin: the question wasn't about expected worst-case, it was about worst-case. Yes, the probability that the worst-case happens is almost zero, but it can happen. The probability that randomized quick sort hits a bad pivot every time is also almost zero, still, it has worst-case complexity of O(n²), even if it has an expected worst-case of O(n*log n).Jörg W Mittag– Jörg W Mittag2015-05-14 13:52:24 +00:00Commented May 14, 2015 at 13:52
- 
        1No. You don't have to search a list. You could mark already found numbers trivially in an array in form: A[ number ] = true/false. (I think "checking array" in the question can be read as such if you like.)Scheintod– Scheintod2016-04-20 11:07:54 +00:00Commented Apr 20, 2016 at 11:07
                    
                        Add a comment
                    
                 | 
            
                
            
        
         
    How to Edit
        - Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
        How to Format
    
    - 
                create code fences with backticks ` or tildes ~
                ```
 like so
 ```
- 
                add language identifier to highlight code
                ```python
 def function(foo):
 print(foo)
 ```
- put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes `like _so_`
- quote by placing > at start of line
- to make links (use https whenever possible)
                <https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
            How to Tag
        
        A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. design-patterns), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you