0% found this document useful (0 votes)
81 views2 pages

Linked Lists: Arrays

Linked lists are a linear and homogenous data structure where each node contains data and a link to the next node. Each item is allocated space in memory as it is added, allowing the list to be of dynamic length. To locate a specific node, the list must be traversed sequentially.

Uploaded by

anilperfect
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)
81 views2 pages

Linked Lists: Arrays

Linked lists are a linear and homogenous data structure where each node contains data and a link to the next node. Each item is allocated space in memory as it is added, allowing the list to be of dynamic length. To locate a specific node, the list must be traversed sequentially.

Uploaded by

anilperfect
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/ 2

Linked Lists Linked list is again a linear data structure of dynamic length.

All components
within the list are of same data type stored in nodes. Thus it is also a homogenous data structure.
To locate a specific node in the list, we must sequentially traverse through the list (Sequential
access). In a linked list, each item is allocated a space in memory as it is added to the list. A link is
kept between each item with the next item in the list. Each node of the list has following two
elements:

Introduction to Data Structures

A data type is an instance of data that may be native to the language or defined by the user. And a
composition of data types, which forms some kind of systematic organization, is called Data
Structure.

Data structure = Organized data + Allowed operations

Simple Data structure can be used as building blocks of complex data structure.

Array is a simple type of Data structure by using which we can build more complex data structure.
Data structure can be classified according to the following four types.

1. Linear & Non-linear: The data stored in a sequence is called Linear, while the other is called
Non-linear e.g. Array is Linear & Tree is Non-linear.

2. Homogenous & Non-homogenous: The data structure, which contains single type of data, is
known as Homogenous whereas others are Non- homogenous. For example, Array is an ordered set
of homogenous elements stored in a contiguous memory location. And Record (structure) is a Non-
Homogenous.

3. Static & Dynamic: This means the allocation of memory, either Static or Dynamic.

4. Direct access & Sequential access: The ability of directly referring to an item without having access
to any other is called Direct access. Sequential access is searching through a number of items before
finding a specific item i.e. an item, which is not directly accessible. For example, arrays provide a
direct access to any element within the array by means of an index (direct access). But in linked lists,
we must traverse through the list to locate a specific node (sequential access).  Some of the data
structures, which will be discussed in detail later in the book, are given below.

Arrays This is a simplest type of linear data structure (one dimensional array), by


means of which a set of finite number say n of similar data elements can be referenced
by a set of n consecutive numbers 1, 2, 3, …….. n. For example, consider the following list
of elements:  5, 6, 8, 4, 3, 1, 2, 56, 67, 78 This list of 10 elements can be stored in an array
of size 10 as
follows:  

 
Note: Arrays will not be discussed hereafter in this book. It will be presumed that the
reader is familiar with arrays.

Queues  Queue is also a linear data structure of dynamic height, which contains single type of
data. Thus it is a homogenous data structure, all components of which are of same data type. A
queue is, also, called a First-In-First-Out (FIFO) system, in which insertion of a component can
take place only at one end, called “rear” end of the queue and deletion of a component can take
place only at other end, called “front” end of the queue (Sequential access). The word “queue” is
thus like the queue at a counter for service, in which customers are dealt with in the order in which
they ar- rive.

Stacks Stack is a linear data structure of dynamic height, all components of which are of same data
type (Homogenous components). A stack is also called a Last-In- First-Out (LIFO) system, in
which insertion and deletion of any component can take place only at the top of the stack, where
‘top’ is an end of the stack. That is, at any given time, the only item, which can be accessed to, is
on the top of the stack (sequential access). A common example of a stack is a dish or a coin
stacker. Dish- es are "pushed" onto the top and "popped" off the top.

You might also like