Setting any value will expand the array and set the other values to undef.Well, yes, but that exactly what the challange wants you to avoid. You don't want to spend time creating undefined values.
Your data structure uses autovivication for the A array so it has the same performance but more overhead.No. It's important to realize I did not describe the A array in Perl terms. Think C, or even better, assembler. Just declare an array as a chunk of memory where integers are stored. No initialization of the elements allowed - just accept whatever values are in memory.
Abigail
In reply to Re: Data structure challenge
by Abigail-II
in thread Data structure challenge
by Abigail-II
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |