Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Summary

Summary DSA notes

Rating
-
Sold
-
Pages
1
Uploaded on
26-03-2023
Written in
2022/2023

the second part of Arrays and Abstract Data Type in Data Structure 2nd.

Institution
Course

Content preview

Array as An Abstract Data Type in Data Structures
ByAnonymous–
Abstract Data Type is a new data type upon which we have defined our set of operations and
values. We can directly link it with object-ended programming. So what have I done ? I 've made
a OneNote Notebook. And here, by the name of 'Algorithms. 1' An integer is not an abstract data
type, it is a primitive data type. Like an integer, I can also make my own data type , Assume that I
want to make a data type called 'my array' The C language is a special type of array. It must have
a total size. total_size. And after that, it must have an address , Base address. Base address is
the pointer. This My Array ADT that's being made The representation of the set of values This is
it. I 'll do it like this. And I'll write here + , meaning the set. of operations. Here I can define some
operations. What can those operations be ? Those operations can be anything. It 's my choice ;
whatever I choose to keep. So we can define a lot of these types of operations And we can make
our custom data types. So I have made a My Array abstract data type.
This is Stack And this is Heap. Stack is the static memory; Heap is the dynamic memory. If I
want to make an array, I can either I make the array in the stack Like if this is the stack of the
main function , okay. This is the heap of my main function. I 'll write Main here. Or I make an
integer pointer here. I request some memory , And make its previous address point , And here
with my array , I can request Its indices will be 0,1,2,3,4. . . Okay ? In this manner, I can add some
values to it 7,8,12,27,88. . . It 's my choice ; whatever I choose to put. So in this way I can make
this array. If we have to make an array of size 'n ' , So n multiplied by ; meaning star Then the size
of operator , and after that, int. In which we will define the total size , the use size , use size, the
base address and after that , We will define some of our operations on it. Figure out once you
see it When I give you the notebook. And here I 'll write ; this is the 'representation ' And after
that, we 'll have 'operations ' So this is operations. Operations.
An array is contiguous blocks of memory, i. e the capacity to store 6 elements. The base
address will be the address of that first element , That the array is pointing towards So this is a
pointer that will store its address Whatever is my first element, the one with 0th index. The
advantage I 'll get is If I ever want to make insertions in this array Then I can move them a little ,
all the elements. But if I define the array as big as I can I might have to make another completely
new array. And I think moving things a bit is better. We can implement this in any programming
language. The capacity of arrays is. . . In that , the updation and access are very fast. So in
arrays , the biggest advantage is this : It is the fact that you can access the element ; You can
calculate from the base address. Assume there is a field in which Starting from 1, at every
kilometre , at every milestone there is. . . a milestone 3. . . 4. . . 5. . . Okay ? Assume this is from
Delhi. . . This is our Delhi and assume there 's a route from here And from here, how many
kilometres away from here. We 'll set up our coding environment And we 'll implement My Array
on a structure.

Written for

Institution
Course

Document information

Uploaded on
March 26, 2023
Number of pages
1
Written in
2022/2023
Type
SUMMARY

Subjects

$10.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
anonymous18

Also available in package deal

Get to know the seller

Seller avatar
anonymous18 My Own
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
3 year
Number of followers
0
Documents
5
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions