looking data structure have these properties:
- fixed size (like
array). - cannot contain same elements (like
hashset). - ability remove element position (like
e remove(int i)inarraylist). - set element in position, if empty, otherwise throw exception.
is there such data structure? or need implement myself?
maybe class t [] , hashset<t>. if hashset contains element added, it's duplicate. if t [] has non-null (or whatever flag), element occupied. remove, you'd need remove both data structures. size can limited through t [].
with 4 operations o(1) time.
Comments
Post a Comment