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

You have nothing in your shopping cart yet.

Title: DSA
Description: here u can learn dsa from basic

Document Preview

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


1
...
This can be extended to both sides, making it open-ended
...

Storing Values in Memory
To store a value in memory, we need to know how much space will be allocated for it
...
The number 5
would need to be converted to binary, which is 32 bits or 4 bytes
...
So, if we were
storing an integer, it would take up 2-4 bytes in memory
...
For example, the value stored in a
variable could be 5, which would be represented as 101 in binary
...
For example, an
array of characters would be of the data type char, and an array of integers would be of
the data type int
...

To declare an array in programming, we use a specific syntax
...
To declare an array, we would use:
int a[16];
This creates an array called "a" with 16 elements
...
For example, we could initialize an array of
integers with the values 1, 2, and 3 like this:
int a[3] = {1, 2, 3};

Representing Arrays in Memory
To represent an array in memory, we need to know how the elements of the array are
stored
...

Each element of the array takes up space in memory, depending on its data type
...

Overall, understanding memory and arrays is crucial to programming, as they are
fundamental building blocks of many programs and applications
...
All the elements in an
array are stored in consecutive/continuous locations with the index starting at zero
...

One important point to note is that arrays are fixed-size
...

Accessing Array Elements
The index of the array starts at zero (although it can start at one in some cases)
...

To access an element, use the formula: base address + (i * size of data type)
...

Dynamic Allocation
The drawback of arrays is that the size needs to be specified at compile time, which may
not always be possible
...
If we
allocate more space than needed, there will be unused memory
...

To dynamically allocate memory, we use functions such as 'malloc' and 'calloc'
...



Title: DSA
Description: here u can learn dsa from basic