Garantie de satisfaction à 100% Disponible immédiatement après paiement En ligne et en PDF Tu n'es attaché à rien
logo-home
Class notes 22ee303 (Cs101) €7,56
Ajouter au panier

Notes de cours

Class notes 22ee303 (Cs101)

 0 fois vendu
  • Cours
  • Établissement

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

Aperçu 1 sur 2  pages

  • 9 octobre 2024
  • 2
  • 2024/2025
  • Notes de cours
  • Jenny
  • Toutes les classes
avatar-seller
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.

Les avantages d'acheter des résumés chez Stuvia:

Qualité garantie par les avis des clients

Qualité garantie par les avis des clients

Les clients de Stuvia ont évalués plus de 700 000 résumés. C'est comme ça que vous savez que vous achetez les meilleurs documents.

L’achat facile et rapide

L’achat facile et rapide

Vous pouvez payer rapidement avec iDeal, carte de crédit ou Stuvia-crédit pour les résumés. Il n'y a pas d'adhésion nécessaire.

Focus sur l’essentiel

Focus sur l’essentiel

Vos camarades écrivent eux-mêmes les notes d’étude, c’est pourquoi les documents sont toujours fiables et à jour. Cela garantit que vous arrivez rapidement au coeur du matériel.

Foire aux questions

Qu'est-ce que j'obtiens en achetant ce document ?

Vous obtenez un PDF, disponible immédiatement après votre achat. Le document acheté est accessible à tout moment, n'importe où et indéfiniment via votre profil.

Garantie de remboursement : comment ça marche ?

Notre garantie de satisfaction garantit que vous trouverez toujours un document d'étude qui vous convient. Vous remplissez un formulaire et notre équipe du service client s'occupe du reste.

Auprès de qui est-ce que j'achète ce résumé ?

Stuvia est une place de marché. Alors, vous n'achetez donc pas ce document chez nous, mais auprès du vendeur shabanas. Stuvia facilite les paiements au vendeur.

Est-ce que j'aurai un abonnement?

Non, vous n'achetez ce résumé que pour €7,56. Vous n'êtes lié à rien après votre achat.

Peut-on faire confiance à Stuvia ?

4.6 étoiles sur Google & Trustpilot (+1000 avis)

65040 résumés ont été vendus ces 30 derniers jours

Fondée en 2010, la référence pour acheter des résumés depuis déjà 15 ans

Commencez à vendre!

Récemment vu par vous


€7,56
  • (0)
Ajouter au panier
Ajouté