The Ds\PriorityQueue::allocate() Function in PHP is used to allocate memory for a PriorityQueue class instance. This function allocates sufficient memory for a given capacity for an instance of PriorityQueue class.
void public Ds\PriorityQueue::allocate ( int $capacity )
Parameters: This function accepts a single parameter $capacity which is an integral value denoting the number of values for which capacity is needed to be allocated.
Return Value: This method does not returns any value.
Below programs illustrate the Ds\PriorityQueue::allocate() Function in PHP:
Allocated Space is: int(8) Allocated space is: int(64)
Allocated Space is: int(8) Allocated space is: int(8) int(128)
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.