Search for notes by fellow students, in your own course and all over the country.

Browse our notes for titles which look like what you need, you can preview any of the notes via a sample of the contents. After you're happy these are the notes you're after simply pop them into your shopping cart.

My Basket

ICT(COMPUTER HARDWARE AND RESOURCES)£11.25

Title: Arrays in Data Structure
Description: Discussed Need of Array, Declaration of Array, Initialization of Array, Memory Representation of Array (Data Structures and Algorithms)

Document Preview

Extracts from the notes are below, to see the PDF you'll receive please use the links above


Understanding Memory and Arrays in Programming
In programming, memory is essentially a long tape of bytes, with each byte containing 8 bits
...
To understand the need for arrays,
we need to examine how areas can be declared, initialized, and represented in memory
...
For
example, the data type int typically takes up 4 bytes to store an integer
...
In traditional compilers, we generally
take 2 or 4 bytes to be the data type for storing numbers
...

The memory manager would allocate some memory for storing a variable, and the value stored
in memory would be represented in binary
...


Using Arrays

An array is a collection of more than one element of the same datatype
...

The number of elements in an array is determined by the size of the array
...
In C language, for example, we
would write:
int n;
to declare an integer variable
...


Initializing Arrays

Arrays can also be initialized with values
...
In a
one-dimensional array, the elements are stored in a single row with multiple columns
...
For example,
an array of integers would take up 2-4 bytes of memory per element
...


Arrays in Memory
In this video, we will discuss how data is stored in arrays in memory
...
The array can be
statically initialized at compile time or dynamically initialized at runtime
...
The elements are stored in
sequential/continuous locations with each element taking up the same amount of memory
...
The size of the
array is the number of elements it can hold (n), with the index ranging from 0 to n-1
...

The array follows the random access method, and accessing an element has a time complexity
of O(1)
...
We may not know how much space we need until runtime
...
If we allocate less space than needed,
we will run out of memory
...
The amount of
memory allocated is not contiguous, and the location of the data may not be known
...
I have
paraphrased and corrected the text to make it more readable
...


Working with Arrays in Java

At runtime, loops and standard functions like Scanner can be used to take user input and store it
in arrays
...
We will also cover how to use arrays and how to access data

from them
...

In this video, we've discussed the declaration, initialization, and accessing of 1D arrays
...

We will also discuss how data items are stored in continuous locations and how random access
works
...
However, we have provided formulas and examples to help with these issues
Title: Arrays in Data Structure
Description: Discussed Need of Array, Declaration of Array, Initialization of Array, Memory Representation of Array (Data Structures and Algorithms)