You are on page 1of 13

Fundamentals of Data Structures

Arrays
By:
232032 - Omkar Khare
232037 - Samruddhi Nande
232041 - Isha Patil
232042 - Krunal Patil
TABLE OF CONTENTS

1 Linear DS 5 Stack using arrays

2 Arrays 6 Pros & Cons

3 Syntax 7 Conclusion

4 Real Time Application 8 References


LINEAR DATA STRUCTURES
● A Linear data structure have
data elements arranged in
sequential manner and each
member element is connected to
its previous and next element.

● Such data structures are easy to


implement as computer memory
is also sequential.
ARRAYS
● An array is a collection of items stored at contiguous
memory locations.
● The idea is to store multiple items of the same type
together. This makes it easier to calculate the position
of each element by simply adding an offset to a base
value, i.e., the memory location of the first element of
the array (generally denoted by the name of the
array).
● The base value is index 0 and the difference between
the two indexes is the offset.
FEATURES OF ARRAYS
-- Elements of the array are -- Elements of the array can be
-- Each element of an array
stored at contiguous randomly accessed since we can
is of same data type and
memory locations where the calculate the address of each element
carries the same size, i.e.,
first element is stored at the of the array with the given base
int = 4 bytes.
smallest memory location. address and the size of the data
element.
SYNTAX
Initialization of
Arrays:
Real time Application of Arrays

An array is an arrangement of objects in a rectangular


manner. So every object in our daily life arranged in
this manner is an array.

Let’s take an egg box. The eggs are arranged in a


rectangular fashion. This is in fact, an example of a 2D
array.
We all read books. The page number present in the books are examples of the array. Skipping to a
particular page number is similar to fetching a random element from an array.

We play cards all the time. We can say that cards are also examples of a single dimension array.
The question in a section of the question paper is an array. Likewise, in day to day life, we can find
many examples of arrays.
PHONE
CONTACTS MATRICES

The contact app on our phone Matrices, the 2D arrays,


contains a lot of contacts. They are widely used in
are stored in the form of an marking surveys which is
array. When we add or delete a an efficient way.
contact in our phone, this is
similar to adding or deleting
elements in an array.

STACK QUEUE
CPU uses the queue
When we give a technique for
computer a mathematical scheduling the tasks
expression it solves it by
the stack
C Program for

STACK Using Arrays

● We have implemented the Stack operations using Arrays.


● The program includes basic operations like push, pop and display.

➔ https://onlinegdb.com/V-o7-1Kie
PROS AND CONS

● Arrays represent multiple data items ● The number of elements to be stored in an


of the same type using a single array should be known in advance.
name. ● An array is a static structure (which means
● In arrays, the elements can be the array is of fixed size). Once declared
accessed randomly by using the the size of the array cannot be modified.
index number. The memory which is allocated to it cannot
● Arrays allocate memory in be increased or decreased.
contiguous memory locations for all ● Insertion and deletion are quite difficult in
its elements. Hence there is no an array as the elements are stored in
chance of extra memory being consecutive memory locations and the
allocated in case of arrays. This shifting operation is costly.
avoids memory overflow or shortage ● Allocating more memory than the
of memory in arrays. requirement leads to wastage of memory
space and less allocation of memory also
leads to a problem.
CONCLUSION
- On a concluding note, it can be said that arrays are a simple and efficient way to store, organize
and manipulate data of the same type through indexing without using repetitive variable names.

- Arrays are intended to hold reasonable amounts of data for a short period of time. On the other
hand, because arrays are held in memory, they are easy to handle and quick to manipulate.

- However, in some circumstances, we may need to work with arrays holding hundreds or thousands
of elements.

- Array has added a new flavour to the programming, the efficiency of C language has reached high
in terms of efficient storing, accessing and manipulation of data, speed and reliability.
REFERENCES

1. http://www.btechsmartclass.com/c_programming/C-Applications-of-
Arrays.html
2. https://beginnersbook.com/2014/01/c-arrays-example/
3. https://www.w3schools.in/c-tutorial/arrays/
4. https://www.cs.uic.edu/~jbell/CourseNotes/C_Programming/Arrays.ht
ml
5. https://www.geeksforgeeks.org/arrays-in-c-cpp/
THANK YOU

You might also like