jeudi 30 novembre 2017

if insertion at beginning and deletion at any place. what if best data structure to choose

Example :

I need to write two function acquire and release. acquire return smallest number, release() will return number to pool.

Let’s say at any instance pool has number {1,2,3,4,5,8,9...18,19,20,.....34.35.36.....48....52}

Acquire will return 6 Acquire will return 7

Release(1) will release 1 and if we call acquire again it will return 1.

Aucun commentaire:

Enregistrer un commentaire