Index handler

From Algowiki
Jump to navigation Jump to search

Representation invariant

This abstract data structure is generic and parameterized by An object of an implementation of this abstract data structure is repesented by:

  1. positive integral number [math]\displaystyle{ N }[/math] and a subset [math]\displaystyle{ I }[/math] of [math]\displaystyle{ \{1,\ldots,N\} }[/math], the current indexes.

Remark: restricted type of map.

Method

Name: reserve index

Precondition: [math]\displaystyle{ |I|\lt N }[/math].

Return value: One of the indexes not in [math]\displaystyle{ I }[/math].

Postcondition: The returned index is inserted in [math]\displaystyle{ I }[/math].

Method

Name: release index