Linked Lists: Introduction Linked lists
Representation of linked list
operations on linked list
Comparison of Linked Lists with Arrays and Dynamic Arrays
Types of Linked Lists and operations-Circular Single Linked List, Double Linked List, Circular Double Linked List
This is a presentation on Linked Lists, one of the most important topics on Data Structures and algorithms. Anyone who is new to DSA or wants to have a theoretical understanding of the same can refer to it :D
Linked Lists: Introduction Linked lists
Representation of linked list
operations on linked list
Comparison of Linked Lists with Arrays and Dynamic Arrays
Types of Linked Lists and operations-Circular Single Linked List, Double Linked List, Circular Double Linked List
This is a presentation on Linked Lists, one of the most important topics on Data Structures and algorithms. Anyone who is new to DSA or wants to have a theoretical understanding of the same can refer to it :D
What is Stack, Its Operations, Queue, Circular Queue, Priority QueueBalwant Gorad
Explain Stack and its Concepts, Its Operations, Queue, Circular Queue, Priority Queue. Explain Queue and It's Operations
Data Structures, Abstract Data Types
This is a presentation on Arrays, one of the most important topics on Data Structures and algorithms. Anyone who is new to DSA or wants to have a theoretical understanding of the same can refer to it :D
What is Stack, Its Operations, Queue, Circular Queue, Priority QueueBalwant Gorad
Explain Stack and its Concepts, Its Operations, Queue, Circular Queue, Priority Queue. Explain Queue and It's Operations
Data Structures, Abstract Data Types
This is a presentation on Arrays, one of the most important topics on Data Structures and algorithms. Anyone who is new to DSA or wants to have a theoretical understanding of the same can refer to it :D
In this you will learn about
1. Definitions
2. Introduction to Data Structures
3. Classification of Data structures
a. Primitive Data structures
i. int
ii. Float
iii. char
iv. Double
b. Non- Primitive Data structures
i. Linear Data structures
1. Arrays
2. Linked Lists
3. Stack
4. Queue
ii. Non Linear Data structures
1. Trees
2. Graphs
Welcome to WIPAC Monthly the magazine brought to you by the LinkedIn Group Water Industry Process Automation & Control.
In this month's edition, along with this month's industry news to celebrate the 13 years since the group was created we have articles including
A case study of the used of Advanced Process Control at the Wastewater Treatment works at Lleida in Spain
A look back on an article on smart wastewater networks in order to see how the industry has measured up in the interim around the adoption of Digital Transformation in the Water Industry.
HEAP SORT ILLUSTRATED WITH HEAPIFY, BUILD HEAP FOR DYNAMIC ARRAYS.
Heap sort is a comparison-based sorting technique based on Binary Heap data structure. It is similar to the selection sort where we first find the minimum element and place the minimum element at the beginning. Repeat the same process for the remaining elements.
The Internet of Things (IoT) is a revolutionary concept that connects everyday objects and devices to the internet, enabling them to communicate, collect, and exchange data. Imagine a world where your refrigerator notifies you when you’re running low on groceries, or streetlights adjust their brightness based on traffic patterns – that’s the power of IoT. In essence, IoT transforms ordinary objects into smart, interconnected devices, creating a network of endless possibilities.
Here is a blog on the role of electrical and electronics engineers in IOT. Let's dig in!!!!
For more such content visit: https://nttftrg.com/
6th International Conference on Machine Learning & Applications (CMLA 2024)ClaraZara1
6th International Conference on Machine Learning & Applications (CMLA 2024) will provide an excellent international forum for sharing knowledge and results in theory, methodology and applications of on Machine Learning & Applications.
Final project report on grocery store management system..pdfKamal Acharya
In today’s fast-changing business environment, it’s extremely important to be able to respond to client needs in the most effective and timely manner. If your customers wish to see your business online and have instant access to your products or services.
Online Grocery Store is an e-commerce website, which retails various grocery products. This project allows viewing various products available enables registered users to purchase desired products instantly using Paytm, UPI payment processor (Instant Pay) and also can place order by using Cash on Delivery (Pay Later) option. This project provides an easy access to Administrators and Managers to view orders placed using Pay Later and Instant Pay options.
In order to develop an e-commerce website, a number of Technologies must be studied and understood. These include multi-tiered architecture, server and client-side scripting techniques, implementation technologies, programming language (such as PHP, HTML, CSS, JavaScript) and MySQL relational databases. This is a project with the objective to develop a basic website where a consumer is provided with a shopping cart website and also to know about the technologies used to develop such a website.
This document will discuss each of the underlying technologies to create and implement an e- commerce website.
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERSveerababupersonal22
It consists of cw radar and fmcw radar ,range measurement,if amplifier and fmcw altimeterThe CW radar operates using continuous wave transmission, while the FMCW radar employs frequency-modulated continuous wave technology. Range measurement is a crucial aspect of radar systems, providing information about the distance to a target. The IF amplifier plays a key role in signal processing, amplifying intermediate frequency signals for further analysis. The FMCW altimeter utilizes frequency-modulated continuous wave technology to accurately measure altitude above a reference point.
Saudi Arabia stands as a titan in the global energy landscape, renowned for its abundant oil and gas resources. It's the largest exporter of petroleum and holds some of the world's most significant reserves. Let's delve into the top 10 oil and gas projects shaping Saudi Arabia's energy future in 2024.
1. VELAMMAL ENGINEERING COLLEGE
An Autonomous Institution, Affiliated to Anna University
Chennai, & Approved by AICTE Delhi
Online Classes on Data Structures ( 19CS208T )
CLASS: II YEAR AUTO
PRESENTED
SARANYA P
AP / DEPT OF CSE
2. DATA+STRUCTURE
Data
Values or set of values of
different data types such as
int, float, etc.,
Way of organizing and
storing information so
that it is easy to use
Structure
Data +
Structure
Way of organizing and storing
data on a computer so that it
can be used easily and
effectively
3. DATA STRUCTURE
•Data Structure is defined as the group of data
elements provides an efficient way of storing or
organising data in a computer.
•It is used in almost every program or software
system.
Examples: Arrays, Linked lists, Stack and
Queue.
4. COURSE OBJECTIVES
• To implement the ADTs stack, queue, list
• To understand the performance of the
implementations of non linear data
structures.
• To understand the performance of various
sorting and searching algorithms.
5. UNIT I-INTRODUCTION TO DATA
STRUCTURE
Abstract Data Types (ADT) – List ADT – array-based
implementation – issues in array based implementation
– Singly linked list: Creation, insertion at first, insertion
at middle, insertion at end, deletion at first, deletion at
middle and deletion at end and display – doubly-linked
lists: Creation, insertion, deletion and display -
Application of lists – Polynomial manipulation:
creation, Addition and subtraction.
6. UNIT II-LINEAR DATA
STRUCTURES
Stack ADT – Operations: push and pop –
Applications –Arithmetic Expressions – convert of
infix expression to postfix Expressions-Queue ADT
– operations: Enqueue and Dequeue – issues in
queue. Application of queue: circular Queue -
Creation, insertion, deletion and display.
9. UNIT III -TREE STRUCTURES
Tree ADT – Binary Tree Representation – Binary
Search Tree ADT – Insertion –Deletion- FindMin –
FindMax- Expression trees – Tree traversals: in-order
traversals, pre-order traversals, post-order traversals .
Balanced Tree: Adelson Velski Landis tree(AVL):
Single rotation with right, Single rotation with left,
Double rotation with left and double rotation with right.
10. UNIT IV - GRAPHS
Definitions – Types of graph – Directed graph,
UnDirected graph, Weighted graph, Unweighted Graph,
Cyclic and Acyclic graph, Complete graph -
Representation –Adjacency Matrix representation –
Adjacency List Representation – Topological sort -
shortest-path algorithms- Dijkstra’s Algorithm –
Minimum spanning tree – Prim's algorithm - Kruskal's
algorithms.
11. UNIT V - ALGORITHMS DESIGN
AND ANALYSIS
Greedy algorithms – Divide and conquer –
Dynamic programming – back tracking –branch
and bound – Randomized algorithms –
algorithm analysis – asymptotic notations –
recurrences – NP complete problems.
14. COURSE OUTCOMES
• Apply abstract data types for various linear an non linear
data structures.
• Illustrate the role of key pre-processing algorithms in
various data structures.
• Use knowledge to balance a Binary Search trees.
• Distinguishes various graph algorithms for finding
minimum path.
• Choose various memory models to represent static and
dynamic Hashed structures.
• Understand the concepts of various searching and sorting
algorithms.
15. TEXT BOOKS
1. M. A. Weiss, “Data Structures and Algorithm
Analysis in C”, Second Edition , Pearson Education,
2016.
2. Reema Thareja, “Data Structures Using C”, Second
Edition , Oxford University Press, 2011
16. REFERENCE BOOKS
1. R. F. Gilberg, B. A. Forouzan, “Data
Structures”, Second Edition, Thomson India
Edition, 2005.
2. Ellis Horowitz, Sartaj Sahni, Susan Anderson-
Freed, “Fundamentals of Data Structures in
C”, Second Edition, University Press, 2008
19. What is Data structure
• Group of Data Elements provides an efficient
way of Storing and organising data in
computer.
Example: Array, Linked List, Stack & Queue.
20. Classification of Data structure
Data structure are generally classified into two classes:
1. Primitive Data Structure
2. Non- Primitive Data Structure
Primitive DS:
The Fundamental Data types which are supported by
the programming language.
Some of the primitive data types are integer, real,
character, Boolean.
21. Non-Primitive DS:
Data structures which are created using primitive data
structures.
Some of the Non-Primitive data types are Trees,
Graphs, Stacks and Lists.
They are further classified into Linear and Non-Linear
Data structure.
22. Data Structure
Linear Data Structure Non-Linear Data
Structure
Static Dynamic Tree Graph
Stack
Queue
Linked List
Array
25. Linear Structures Non-Linear Structures
Elements of DS are stored in a
linear or sequential order.
Examples: Arrays, linked lists,
stacks, and queues.
Represented in 2 ways.
1. By means of sequential
memory locations.
2. By means of links.
Single level of elements.
•Elements of a data structure are
not stored in a sequential order.
Examples: Trees and graphs.
•The relationship of adjacency is
not maintained between
elements.
•Can have Multiple Level of
Elements.
•Traversal is not easy as linear
Structures.
26. Operations of Data Structure
The different operations that can be performed
under Data structure are,
1. Traversing
2. Searching
3. Inserting
4. Deleting
5. Sorting
6. Merging Lists
27. Abstract Data Types
• Mathematical model for data types are known
as Abstract Data Types or ADT.
• ADT is a special kind of data type defines by
set of value and set of operations.
• ADT is made of with primitive data types, but
operation logics are hidden.
• ADT lets user to know what a data type can do
but not how it will be implemented.
Example: Stack, Queue, List.
28. ABSTRACT DATA TYPE:
1. ADT is a mathematical abstractions which
means representing the implementation of the
set of operations by using the modular design.
2. Example: List, sets and graphs along with
their operations.
3. Implementing ADT is that operations are
written once in a program and can be called
by any part of the program.
30. LIST
• List is an ordered set of elements(linear
collections of data items)
• General form :A1,A2,A3…….An(suffix).The size
of the list is n.
A1-first element
A2-second element
An-nth element
• A list of size 0 is called the empty list or empty
null list.
31. LIST ADT
• List is an ADT representing countable number
of values, same values can occur more than
once.
• List is an example of containers, they contain
values.
• List is a linear collection, like stack and queue
but is more flexible.
• Adding and removing elements from a list does
not have to happen at one end.
32. List ADT can be represented in two
ways
•Array
•Linked List
33. Types of LIST ADT
Ordered List–Names in Alphabetical order. Elements
themselves defines where they are stored in list.
Front Rear
18
Unordered List – Shopping List. New element is
inserted at front, rear, after a particular element already
in the list.
Inserted anywhere
5 10 15 20
34. Indexed List
Elements are referenced by their numeric position in
the list called index.
Every time list changes the position of the element
may change.
Example: Current First Place in a Race
1 2 3 4 5
Inserted anywhere but list changes
35. REPRESENTATION OF LIST ADT
• A list is a series of related data items.it can be an
ordered collection of integer items like
30,40,75,93,87 (or) it can be like a structures like,
struct student
{
int age;
char name;
int mark;
};
With each structure containing a set of related items.
36. Array Based Implementation
• To implement lists using array, we need an array for
storing entries: List Array [0,1,2,….m], a variable
curr to keep track of number of array elements
currently assigned.
List Array Curr
Size 0 1 2 n-1 maxsize m
No. of items in list
Current size of List, variable to record max length of array
n a1 a2 a3 ………… an unused
37. Issues in Array
• Fixed size: Resizing is expensive
• Requires continuous memory for allocation
– Difficult when array size is larger
• Insertions and deletions are inefficient
– Elements are usually shifted
• Wastage of memory space unless the array is
full
38. List Implementation using array:
1. Create
2. Display
3. Insert
4. Delete
5. Search
• Fix one end of list at index0 and elements will be
shifted when an element is added or removed.
• Insert at position 0, will push entire array to
right one spot to make room for new element.
39. • Deleting an element at position 0 shifts all
elements to left one spot.
Insert 2 here
0 1 2 3 4
5 10 7 12
2 5 10 7 12
40. Advantages of Array Based
implementation of list:
• Array is a natural way to implement list,
convenient and easy.
• Array allows fast, random access of elements.
• Array Based implementation is memory
efficient since very little memory is required.
41. Disadvantages:
• Size of the list must be known when the array is
created and is fixed.
• Array Implementation of lists use a static data
structure.
• Deletion and insertion of elements into the list is
slow since it involves shifting the elements.
• If insertion and deletion is towards the front,
elements must shuffle down.
• This is slow and inefficient.
42.
43. List implementation using Array:
The following operations are performed
1.Create
2.Display or Traverse
3.Insert
4.Delete
5.Search or Find
44. Example program
1. Creation:
#include<stdio.h>
#define MAX 10
int a[MAX],i,n,data,pos;
void create()
{
printf("Enter the size of array");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("enter the element %d:",i+1);
scanf("%d",&a[i]);
}
}
46. 3. Insert
void insert()
{
printf("Enter the position to insert");
scanf("%d",&pos);
if(pos<1 || pos>n)
{
printf("enter the correct position");
}
else
{
printf("Enter the data to insert");
scanf("%d",&data);
48. 4. Deletion:
void deletion()
{
printf("enter the position to delete");
scanf("%d",&pos);
if(pos<1 || pos>n)
{
printf("enter the correct position");
}
else
{
for(i=pos-1;i<=n;i++)
{
a[i]=a[i+1];
}
n--;
printf("element deleted from the position:%d", pos);
}
}
49. 5. Search:
void search()
{
int flag=1;
printf("enter the element to search"); scanf("%d",&data);
for(i=0;i<n;i++)
{
if(a[i]==data)
{
printf("data found at index:%d",i); flag=0;
}
}
if(flag==1)
{
printf("element not found");
}
}
51. Linked List
•Linked list is a data structure which is in linear
form of representing the data nodes.
•A linked list is a sequence of data structures,
which are connected together via links.
•Each link contains a connection to another link. It
is the second most-used data structure after array.
2parts: Data Section - Contains data element to be stored
Address/Pointer Section - Contains the address of
next node
52. Declaration of a node:
struct node
{
int data;
struct node *next;
};
53. Types of Linked List
1. Singly Linked List − Item navigation is forward
only.
2. Doubly Linked List − Items can be navigated
forward and backward.
3. Circular Linked List − Last item contains link
of the first element as next and the first element
has a link to the last element as previous.
54. Singly Linked List
• Singly Linked List is unidirectional and it can be
traversed in only one direction from head to last
node.
• A single node contains data and a pointer to the
next node.
• Visualized as a chain of nodes, every node points
to next node.
55. Insertion Operation
• Memory is to be allocated for the new node
before reading the data.
• The new node will contain empty data field
and empty next field.
• The data field of the new node is then stored
with the information read from the user.
• The next field of the new node is assigned to
NULL.
56. 3ways to insert a node
The new node can then be inserted at three
different places namely:
• Inserting a node at the beginning.
• Inserting a node at the end.
• Inserting a node at intermediate position.
57. Insertion Example
• Adding a new node in linked list is a more than one
step activity. First, create a node using the same
structure and find the location where it has to be
inserted.
• Imagine that we are inserting a
node B (NewNode), between A (LeftNode)
and C (RightNode). Then point B.next to C
58. • NewNode.next −> RightNode
• Now, the next node at the left should point to
the new node.
59. • LeftNode.next −> NewNode; This will put the
new node in the middle of the two.
• Similar procedure takes place when a node is
being inserted at the beginning of the list. While
inserting it at the end, the second last node of the
list should point to the new node and the new
node will point to NULL.
63. Deletion Operation
• Deletion of a node is an another primitive
operation that can be done in a singly linked list.
• Memory is released for the node to be deleted.
• A node can be deleted from the list from three
different places namely.
• Deleting a node at the beginning.
• Deleting a node at the end.
• Deleting a node at intermediate position.
64. Deletion Example
• Deletion is also a more than one step process.
First, locate the target node to be removed, by
using searching algorithms.
65. • The left (previous) node of the target node
now should point to the next node of the
target node
• LeftNode.next −> TargetNode.next;
66. • This will remove the link that was pointing to the target
node. Now, using the following code, we will remove
what the target node is pointing at.
• TargetNode.next −> NULL; we can simply deallocate
memory and wipe off the target node completely.
70. Functions used in LL Programs:
• malloc() is a system function which allocates a
block of memory in the "heap" and returns a
pointer to the new block.
• The prototype of malloc() and other heap
functions are in stdlib.h. malloc() returns NULL if
it cannot fulfill the request.
void *malloc (number_of_bytes)
71. • Since a void * is returned the C standard states
that this pointer can be converted to any type.
char *cp;
cp = (char *) malloc (100);
• Attempts to get 100 bytes and assigns the starting
address to cp. We can also use the sizeof()
function to specify the number of bytes.
int *ip;
ip = (int *) malloc (100*sizeof(int));
72. • free() is the opposite of malloc(), which de-
allocates memory. The argument to free() is a
pointer to a block of memory in the heap — a
pointer which was obtained by a malloc()
function.
• The syntax is:
free (ptr);
• The advantage of free() is memory management
when we no longer need a block.
73. Singly Linked List
Operations performed:
Create
Display
Insert at beginning
Insert at last
Insert at middle
Delete at beginning
Delete at last
Delete at middle
Search
85. Delete a node at middle
void deleteatmiddle()
{
int pos,i;
node *temp,*prev;
printf("enter the position to delete");
scanf("%d",&pos);
if(pos>1 && pos<numberofnodes())
{
temp=prev=head;
for(i=1;i<pos;i++)
{
prev=temp;
temp=temp->next;
}
89. Doubly Linked List
•Doubly Linked List is a variation of Linked list in
which navigation is possible in both ways, either
forward and backward easily.
• It has an extra pointer pointing to the previous node,
adding an extra link to the list.
•It simplifies deletion as it no longer have to refer to the
key using pointer to the previous cell.
90. Terms used under DLL
• Link − Each link of a linked list can store a data called an
element.
• Next − Each link of a linked list contains a link to the next link
called Next.
• Prev − Each link of a linked list contains a link to the previous
link called Prev.
• Linked List − A Linked List contains the connection link to
the first link called First and to the last link called Last.
91. • Doubly Linked List contains a link element called first
and last.
• Each link carries a data field(s) and two link fields called
next and prev.
• Each link is linked with its next link using its next link.
• Each link is linked with its previous link using its
previous link.
• The last link carries a link as null to mark the end of the
list.
92. Basic Operations
Following are the basic operations supported by a list.
• Insertion − Adds an element at the beginning of the list.
• Deletion − Deletes an element at the beginning of the list.
• Insert Last − Adds an element at the end of the list.
• Delete Last − Deletes an element from the end of the list.
• Insert After − Adds an element after an item of the list.
• Delete − Deletes an element from the list using the key.
• Display forward − Displays the complete list in a forward
manner.
• Display backward − Displays the complete list in a
backward manner.
95. Insert link at the last location
void insertLast(int key, int data)
{
struct node *link = (struct node*)
malloc(sizeof(struct node));
link->key = key;
link->data = data;
if(isEmpty())
{
last = link;
}
else
{
last->next = link;
link->prev = last;
}
last = link;
}
96. Circular Linked List
• Circular Linked List is a variation of Linked
list in which the first element points to the last
element and the last element points to the first
element.
• Both Singly Linked List and Doubly Linked
List can be made into a circular linked list.
97. Singly Linked List as Circular
• In singly linked list, the next pointer of the last
node points to the first node.
98. Doubly Linked List as Circular
• In doubly linked list, the next pointer of the last node
points to the first node and the previous pointer of the
first node points to the last node making the circular
in both directions.
• The last link's next points to the first link of the list in
both cases of singly as well as doubly linked list.
• The first link's previous points to the last of the list in
case of doubly linked list.
99. Basic Operations
• insert − Inserts an element at the start of the
list.
• delete − Deletes an element from the start of
the list.
• display − Displays the list.
100. APPLICATIONS OF LINKED LISTS :
•Linked lists can be used to represent
polynomials and the different operations that
can be performed on them.
•In this section, we will see how polynomials
are represented in the memory using linked
lists.
101. Polynomial Representation:
• Let us see how a polynomial is represented in the memory using
a linked list. Consider a polynomial 6x3 + 9x2 + 7x + 1. Every
individual term in a polynomial consists of two parts, a
coefficient and a power. Here, 6, 9, 7, and 1 are the coefficients
of the terms that have 3, 2, 1, and 0 as their powers respectively.
Every term of a polynomial can be represented as a node of the
linked list.