Skip to content

Instantly share code, notes, and snippets.

@PearlMiglani
Created June 16, 2021 17:26
Show Gist options
  • Save PearlMiglani/1927e075f929a920efb8b768824c872f to your computer and use it in GitHub Desktop.
Save PearlMiglani/1927e075f929a920efb8b768824c872f to your computer and use it in GitHub Desktop.
stream=[1,2,3,4,5,6,4,2,5,9,1,6,3,7,1,2,2,4,2,1]
print('Using conventional Algorithm:')
start_time = time.time()
st_unique=[]
for i in stream:
if i in st_unique:
continue
else:
st_unique.append(i)
print('distinct elements',len(st_unique))
print("--- %s seconds ---" % (time.time() - start_time))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment