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 A bird eye view on Data structures.

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

The world of computer science and programming is vast and varied, with many different data structures and algorithms that can be used to solve complex problems. These important data structures will help you gain more insights into the use cases of different data structures.

Show more Read less
Institution
Course

Content preview

DATA STRUCTURES

Data structures are simply a method of organising data in a computer. Why do we
need them? Because the amount of data is very large, using different types of data
structures according to our needs becomes very important because it helps us in
storing the data efficiently and retrieving the data quickly in the future when we
need to do something with the data.On dynamic data structures, we can perform some
of the basic operations that we can perform on these data structures. An array is
simply a collection of data elements of the same type that are stored in contiguous
memory locations.
To declare an array we should know two things first the size of the element and
the data type if i know these two things i can create an array and the syntax is
very easy. Arrays store only similar type of data elements which mean it will store
the similar types of data types. The indexing of an array always starts from 0.

The main advantage of using an array is that you can access any element in the
array in the order of 1. The second advantage of creating an array is that it
eliminates the need to define multiple variables. For example, if I wanted to store
five numbers, I could use five variables a ,b, c, d and e integer of int type only
and these five variables could only store one single value. The other disadvantage
is that if I create a five-length or five-size array but only store three elements
in it, the remaining two memory locations are wasted. A linked list has a separate
entity that stores two items. the element's own worth and the address of the next
element. Every node or object in this linked list has two values stored in it.
Assume it is storing a value of one, three, and five in this seven, and this
address part of this node will store the memory location of this. A linked list is
dynamic insurance, which means that its size can be changed based on our names. The
second major advantage is that there is no memory waste, as opposed to arrays,
where if I create an array of size 10 and add only eight elements, the last two
memory locations are wasted.If the head node head node is the first node of the
list and all the operations in the linked list are related to head.

Stack is a linear data structure that operates on the last in first out principle,
which means that the last element to enter the stack will be the first element to
be removed from the stack. stack stack works in this manner, so what are the
prerequisites for declaring a stack? For example, we should know the data type of
the element that we are going to store in the stack. The code is correct.
Previously, it wasn't working because I was calculating the size after each pop
element, so the size was changing, which caused it to fail, so I just saved the
initial size in length and then used that size to pop the elements.we can also use
peak method which will only show us the top of the stack. The disadvantages of a
linked list the major advance disadvantage of sorry stack rather is that not much
flexible because in order of course this is the stack in order to get this element
i 'll have to pop one by one on the top elements. We should know the data type of
the element that we are going to store let 's see the syntax as well right queue
data type variable name new here we do n't write queues we write linked list. The
other operations which we want to do is when we. want to add an element in a cube
we can use add function you can simply write name dot and hello now this will add
the element from the rear end.

hash maps are a data structure which store a different key value pair. The keys and
values are the same but the keys are different and correspondingly whole key value
pairs are different. That is the unique ability of the hashmap so let 's try it and
what are the prerequisites to declare an asmr we must know the data types of the
key and the value. Let 's talk about some of the advantages and disadvantages of a
hashmap.The disadvantage of using hashmap is that it cannot hold multiple keys
values, so if there is the same value or say different values like one
corresponding to three and some value corresponding to five, map will fail in this

, way. There is one problem in there, though, what if the head that they gave us is
null or just the next element is null? In that case, we should simply return the
head and do nothing.

Data structure learning is an important part of computer science and programming.
The following is a recommended learning sequence for data structures
1.Array
2. Linked list
3.Stack
4.Queues
5.Trees
6.Graph
7.Hash

ARRAYS :-
Arrays are one of the most basic and fundamental data structures in computer
programming. They are a collection of elements of the same data type that are
stored contiguously in memory. Arrays can be used to store and manipulate data in a
variety of ways, making them a versatile tool in programming.
Here are some key points to keep in mind when working with arrays

Declaring an Array:
To declare an array in most programming languages, you need to specify the data
type of the elements in the array, as well as the size of the array. For example,
in C++, you can declare an array of integers with 10 elements using the following
code:

int myArray[10];

Initializing an Array:
You can initialize the values in an array at the time of declaration, or you can
assign values to the array later in your code. For example, in C++, you can
initialize an array of integers with the values 1, 2, 3, 4, and 5 like this:

int myArray[] = {1, 2, 3, 4, 5};

Accessing Elements in an Array:
You can access individual elements in an array using their index, which starts at 0
for the first element in the array. For example, to access the third element in the
array myArray, you would use the following code:

int thirdElement = myArray[2];

Modifying Elements in an Array:
You can modify the values of individual elements in an array by assigning a new
value to their corresponding index. For example, to change the value of the second
element in the array myArray to 10, you would use the following code:

myArray[1] = 10;

Bounds Checking:
It's important to be aware of the size of an array and to avoid accessing elements
outside of the array bounds, as this can cause errors in your program or even crash
it. Many programming languages provide built-in bounds checking to help prevent
these errors.

Array
Operations: Arrays support a variety of operations, including sorting, searching,
and traversing. Many programming languages provide built-in functions or libraries

Written for

Course

Document information

Uploaded on
March 3, 2023
Number of pages
7
Written in
2022/2023
Type
SUMMARY

Subjects

$8.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
abhayrana

Get to know the seller

Seller avatar
abhayrana NATIONAL INSTITUTE OF TECHNOLOGY,AGARTALA
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
3 year
Number of followers
0
Documents
1
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