You are on page 1of 9

Techno International Newtown

Technical Report Writing for CA-2 Examination

Name-Manikant Pandey
Roll No.-
Dept.- Information technology
Sec- B
Semester- 3rd
Sub- Data Structures and Algorithms
(PCC CS301)
Array

It is a linear Data Structure which is a collection of data of the same Data type
stored at contiguous memory locations.

For Example- Array of Integer(typed as “int” in c syntax) Data Type can only store
integers.

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).

Real life uses-


We store DEBIT CARD Details i.e., Debit card number (which is a 16 digit
number) in the form of an array of “int” Data type.
Or we can store our contact information (i.e., mobile phone number) in our phone
in the form of an array.

History
The first digital computers used machine-language programming to set up and
access array structures for data tables, vector and matrix computations, and for
many other purposes.
Central Features of Data Structures-

(1) Time complexity- It is mainly the amount of time we put in


creating a program and the results that we get in the minimum
possible time. Those programs which take less time will have a
good time complexity.

(2) Space Complexity- Those programs and those data structures


which take less memory and utilize the given memory in a better
way and give us the desired results are most suitable in Space
Complexity.

(3) Efficiency- Those programs which will have good Time


Complexity and Space Complexity will be a more efficient
Program.

Motivation
Now the very next thing which comes into our mind is Why do we have
to learn Array Data Structure ?
So, here we will give some practical uses to motivate students to learn
and use Arrays.

(1) It is used to store the data of same type.So, we can store our contact
details(i.e., our mobile phone numbers) using arrays.

(2) To store the possible moves of chess on a chessboard.


(3) 2D Arrays, commonly known as matrices, are used in image
processing.

(4) Your viewing screen is also a multidimensional array of pixels.

Array Representation-

As we are more concerned about the syntax of C Programming


language. So, In C Array can be represented as-

This array is initialized.


We can also declare arrays first and then initialize it later. But in that
case we have to enter the size while declaring the array .

Here in the given pictorial representation we are trying to show how the
indexing is done.
Suppose for example the size of an array is ‘n’.
Then the indexing will be from ‘n’ to ‘n-1’.
Code to represent Declaration and Initialization of Array at the same
time-

Code to represent Declaration first and initialization later-


Basic Operation in Array

Following are the basic operations supported by an array.

Traverse − print all the array elements one by one.


Insertion − Adds an element at the given index.
Deletion − Deletes an element at the given index.
Search − Searches an element using the given index or by the
value.
Update − Updates an element at the given index.

METHODOLOGY

There are few methods to access arrays. These are as follows:


Name Description

every() Checks if every element in an array pass a test.

fill() Fill the elements in an array with a static value.

filter() Creates a new array with every element in an

array that pass a test.


find() Returns the value of the first element in an array

that passes a test

Conclusion

Array is one data structure that has been used (as well as abused)
more than any other. Arrays are simple yet reliable and are used in
more situations than you can count.

Arrays are useful when the number of elements to be stored is


fixed. They are easy to traverse, search and sort.

Yet they have problems that are typical to them,which at times lead
to serious performance issues. They are like old friends. You
accept and live with their qualities -good as well as bad.
References

Books- Data structure through C by Yashavant Kanetkar


Let us C by Yashavant Kanetkar

Websites- Google
GeeksforGeeks
Tutorialspoint

You might also like