3. NON-LINEAR DATA STRUCTURE
Non-linear Data Structure: Data structures where data elements are not
arranged sequentially or linearly are called non-linear data structures.
Examples of non-linear data structures are:
Tree
Graphs
4. A tree data structure, along with graphs, are
two non-linear data structure that store data
in a non-common but specific way (compared
to linear structures collections such as
arrays).
Trees are a collection of data formed of data elements called Nodes; Nodes are
connected to each other by edges; each node element may or may not have child nodes.
Tree
In each Tree collection, we have one root node, which is the very first node in our tree.
If a node is connected to another node element, it then becomes a parent node and its connected node is
its child node.
5.
6. Binary Tree,
Binary Search Tree
AVL Tree
Red-Black Tree
Splay Tree
Heap and Tries
Types of Trees
7. GRAPH
• A graph data structure is a collection of
nodes that have data and are connected to
other nodes.
• Let's try to understand this through an
example. On Facebook, everything is a
node. That includes User, Photo, Album,
Event, Group, Page, Comment, Story, Video,
Link, Note...anything that has data is a
node.
• Every relationship is an edge from one
node to another. Whether you post a
photo, join a group, like a page, etc., a new
edge is created for that relationship.
All of Facebook is then a collection of these nodes and
edges. This is because Facebook uses a graph data
structure to store its data.
More precisely, a graph is a data structure (V, E) that
consists of
•A collection of vertices V
•A collection of edges E, represented as ordered pairs of
vertices (u,v)
8.
9. Create: The create operation results in reserving memory
for program elements. This can be done by declaration
statement. Creation of data structure may take place either
during compile-time or run-time. malloc() function of C
language is used for creation.
.
Selection: Selection operation deals with accessing
a particular data within a data structure.
Data Structures
Operation
Updating: It updates or modifies the data in the
data structure.
Searching: It finds the presence of desired data
item in the list of data items, it may also find the
locations of all elements that satisfy certain
conditions
Sorting: Sorting is a process of arranging all data
items in a data structure in a particular order, say for
example, either in ascending order or in descending order.
Traversal: Traversal is a process of visiting each and every node of a list in systematic manner.
Merging: Merging is a process of combining the data
items of two different sorted list into a single sorted list.
Destroy: Destroy operation destroys memory space
allocated for specified data structure. free() function of
C language is used to destroy data structure.
Design of efficient data structure must take operations to be
performed on the data structures into account.
Splitting: Splitting is a process of partitioning single
list to multiple list.