Arrays
Arrays
Introduction
Array
unpacked array
packed array
❏ Unpacked array : Each element of array is stored separately.Index is defined after the array identifier.
❏ Packed array : The element of the array are stored as one item. Index is defined before the array
identifier.
DYNAMIC ARRAY
❏ A dynamic array is an array whose size must change during simulation.
❏ Memory location is created before use.
❏ new[] method is used to create array or change the size of the array.
❏ When the size of the collection is unknown or the data space is sparse, an associative array is
used.
❏ In associative array, memory location is not created before use.
push_front() method inserts the given element at the front of the queue.
push_back() method inserts the given element at the end of the queue.
Array querying functions
Array locator methods are useful for finding the index or elements of an array.
Operate on any unpacked arrays and queues.
Return type of these methods is a queue.
Array Locator Methods
find_first_index() returns the index of the first element satisfying the given expression
find_last_index() returns the index of the last element satisfying the given expression
min() returns the element with the minimum value or whose expression evaluates to
a minimum
max() returns the element with the maximum value or whose expression evaluates
to a maximum
unique() returns all elements with unique values or whose expression is unique
unique_index() returns the indexes of all elements with unique values or whose expression is
unique
Array ordering methods
Array ordering methods can reorder the elements of one-dimensional arrays or queues.
The expressions used by array manipulation methods sometimes need the actual array indexes
at each iteration, not just the array element. The index method of an iterator returns the index
value of the specified dimension.
array_1 = '{10,20,2,40,67,5};
temp_qu = array_1.find with ( item == item.index );
THANK YOU