Simple Steps to Using Arrays
Choose the Size: First, decide how big your array will be. For example, if you pick a size of , it can hold items.
Set Aside Space: Next, you need to set aside a space in memory for your array. This usually takes a time of .
Set Starting Values: Now, give each item in your array a starting value, often zero. This also takes time.
Get Items Quickly: You can grab any item from the array right away. This takes constant time, , because you can find it directly.
Good Things About Arrays:
Not So Good Things About Arrays:
Simple Steps to Using Arrays
Choose the Size: First, decide how big your array will be. For example, if you pick a size of , it can hold items.
Set Aside Space: Next, you need to set aside a space in memory for your array. This usually takes a time of .
Set Starting Values: Now, give each item in your array a starting value, often zero. This also takes time.
Get Items Quickly: You can grab any item from the array right away. This takes constant time, , because you can find it directly.
Good Things About Arrays:
Not So Good Things About Arrays: