0% found this document useful (0 votes)
11 views

C DS Basics

Data structures are a way to organize and store data to allow for efficient operations. There are linear structures like arrays and linked lists, non-linear structures like trees and graphs, and common structures include stacks, queues, hash tables and binary trees which allow different data access operations.

Uploaded by

rojamani ganta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

C DS Basics

Data structures are a way to organize and store data to allow for efficient operations. There are linear structures like arrays and linked lists, non-linear structures like trees and graphs, and common structures include stacks, queues, hash tables and binary trees which allow different data access operations.

Uploaded by

rojamani ganta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

https://www.atnyla.

com/tutorial/about-dsa/3/295

What is Data Structures


Data Structures are the programmatic way of collecting and organizing data in
such a way that we can perform operations on these data in an effective way.

Various types of Data structures


Anything that can store data can be called as a data structure, hence Integer,
Float, Boolean, Char etc, all are data structures. They are known as Primitive
Data Structures.
Then we also have some complex Data Structures, which are used to store
large and connected data. Some example of Abstract Data
Structure(ADT) are :

 Stack
 Queue
 Linked List
 Tree
 Graph
 etc.

All these data structures allow us to perform different operations on data. We


select these data structures based on which type of operation is required. We
will look into these data structures in more details in our later lessons.
Descriptions:
Linear:

In Linear data structures,the data items are arranged in a linear sequence.


Example: Array

Non-Linear:

In Non-Linear data structures,the data items are not in sequence.


Example: Tree, Graph

Homogeneous:

In homogeneous data structures,all the elements are of same type.


Example: Array

Non-Homogeneous:

In Non-Homogeneous data structure, the elements may or may not be of the


same type.
Example: Structures

Static:
Static data structures are those whose sizes and structures associated memory
locations are fixed, at compile time.
Example: Array

Dynamic:

Dynamic structures are those which expands or shrinks depending upon the
program need and its execution. Also, their associated memory locations
changes.
Example: Linked List created using pointers

Array
Arrays are a very simple data structure and may be thought of as a list of a
fixed length. Arrays are nice because of their simplicity, and are well suited for
situations where the number of data items is known (or can be
programmatically determined). Suppose you need a piece of code to calculate
the average of several numbers. An array is a perfect data structure to hold the
individual values, since they have no specific order, and the required
computations do not require any special handling other than to iterate
through all of the values. The other big strength of arrays is that they can be
accessed randomly, by index. For instance, if you have an array containing a
list of names of students seated in a classroom, where each seat is numbered 1
through n, then studentName[i] is a trivial way to read or store the name of
the student in seat i.

An the array might also be thought of as a pre-bound pad of paper. It has a


fixed number of pages, each page holds information, and is in a predefined
location that never changes.

Linked Lists
A linked list is a data structure that can hold an arbitrary number of data items
and can easily change size to add or remove items. A linked list, at its simplest,
is a pointer to a data node. Each data node is then composed of data (possibly
a record with several data values), and a pointer to the next node. At the end of
the list, the pointer is set to null.

Queues
A queue is a data structure that is best described as "first in, first out". A real-
world example of a queue is people waiting in line at the bank. As each person
enters the bank, he or she is "enqueued" at the back of the line. When a teller
becomes available, they are "dequeued" at the front of the line.

Priority Queues
In a typical breadth-first search (BFS) algorithm, a simple queue works great
for keeping track of what states have been visited. Since each new state is one
more operational step than the current state, adding new locations to the end
of the queue is sufficient to ensure that the quickest path is found first.
However, the assumption here is that each operation from one state to the
next is a single step.

Stacks
Stacks are, in a sense, the opposite of queues, in that they are described as
"last in, first out". The classic example is the pile of plates at the local buffet.
The workers can continue to add clean plates to the stack indefinitely, but
every time, a visitor will remove from the stack the top plate, which is the last
one that was added.

Trees
Trees are a data structure consisting of one or more data nodes. The first node
is called the "root", and each node has zero or more "child nodes". The
maximum number of children of a single node, and the maximum depth of
children are limited in some cases by the exact type of data represented by the
tree.

Binary Trees
A special type of tree is a binary tree. A binary tree also happens to be one of
the most efficient ways to store and read a set of records that can be indexed
by a key value in some way. The idea behind a binary tree is that each node
has, at most, two children.

Hash Tables
Hash tables are a unique data structure and are typically used to implement a
"dictionary" interface, whereby a set of keys each has an associated value. The
key is used as an index to locate the associated values. This is not unlike a
classical dictionary, where someone can find a definition (value) of a given
word (key).

You might also like