Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
College aantekeningen

Class notes 22ee303 (Cs101)

Beoordeling
-
Verkocht
-
Pagina's
2
Geüpload op
09-10-2024
Geschreven in
2024/2025

it gives a brilliant introduction to the usage and needs of arrays that are important for storing, manipulating and gaining knowledge about data manipulation and accessing the data structures. Happy learning! continuous notes are uploaded on the regular basis

Meer zien Lees minder
Instelling
Vak

Voorbeeld van de inhoud

Arrays and Memory Representation
Arrays form the core data structure in computer science. Their role is to help store and
manipulate large numbers of data values. This chapter explains how arrays are stored in
memory and how this understanding can be used to improve the performance of our
programs.

Memory Representation
The first step toward comprehension of how arrays are stored in memory is to understand
the basic operations of memory itself. Memory consists of a vast array of bytes, each
uniquely addressed. When any variable is declared, the operating system reserves a given
block of memory for the variable and maintains the address of the location in a register.
For instance, let us take the declaration of the integer variable x and its initial assignment as
5.
int x = 5;
This could store the address of 0x1000 in variable x but keep value 5 at that particular
address.

Arrays
An array is defined to be a set of variables that have the same data type, aligned in memory
and located in contiguous memory addresses. Thereby, when a programmer declares an
array of integers using the syntax int arr[10], the operating system assigns a sufficient
segment of memory for ten integers so that each integer will occupy successive memory
locations.
For instance, say an integer array is declared: int arr[10] = {1, 2, 3, 4, 5}. The OS might assign
the address 0x2000 to store the address of arr and write the corresponding values in the
following way:
Number | Value | \n--- | --- | \n0x2000 | 1 | \n0x2001 | 2 | \n0x2002 | 3 | \n0x2003 | 4
| \n0x2004 | 5 |
The elements of an array may be referenced using indices, which are integers, starting at
zero, increasing by one for every successive element. So the first element of an array is
accessed by arr[0], the second by arr[1], and so on.
Accessing Arrays Accessing elements from an array is one of the most common operations in
programming, yet also one of the slowest if not done very carefully, as access to elements
involves reading from and writing to physical locations within the memory that is used by a
computer.
In other words, there is an alternative method of improving the access efficiency of the array
called blocking, that is, partitioning of an array into blocks or segments and then accessing
these segments sequentially. This ensures less number of memory accesses.

Geschreven voor

Instelling
Vak

Documentinformatie

Geüpload op
9 oktober 2024
Aantal pagina's
2
Geschreven in
2024/2025
Type
College aantekeningen
Docent(en)
Jenny
Bevat
Alle colleges

Onderwerpen

€7,52
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper
Seller avatar
shabanas

Maak kennis met de verkoper

Seller avatar
shabanas sri eshwar college of engineering
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
-
Lid sinds
1 jaar
Aantal volgers
0
Documenten
2
Laatst verkocht
-

0,0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen