Find gaps in a sequence of Strings
<p>I have got a sequence of strings - <code>0000001, 0000002, 0000003....</code> upto 2 million. They are not contiguous. Meaning there are gaps. Say after 0000003 the next string might be 0000006. I need to find out all these gaps. In the above case (0000004, 0000005).</p>

<p>This is what I have done so far - </p>

<pre><code>gaps  = list()
total = len(curr_ids)

for i in range(total):
    tmp_id = '%s' %(str(i).zfill(7))
    if tmp_id in curr_ids:
        continue
    else:
        gaps.append(tmp_id)
return gaps
</code></pre>

<p>But as you would have guessed, this is slow since I am using <code>list</code>. If I use a <code>dict</code>, to pre-populate curr_ids it'll be faster. But what's the complexity to populating a hash-table? What's the fastest way to do this. </p>
