Initialise Array

Hi guys,When we want to initiliase an array P which consists of N positions,do we have to initilaise all the positions in order to point to NULL?This demands O(n) time although we may not use all the positions.Thanks,in advance!
[256 byte] By [g_p_javaa] at [2007-10-2 10:39:19]
# 1

> When we want to initiliase an array P which consists

> of N positions,do we have to initilaise all the

> positions in order to point to NULL?

No.

When you do Object[] array = new Object[10];

all elements point to null, no need to loop through the array assigning null values to them.

prometheuzza at 2007-7-13 2:45:10 > top of Java-index,Other Topics,Algorithms...