LINKED LIST.

Slides:



Advertisements
Similar presentations
Linked Lists Linked Lists Representation Traversing a Linked List
Advertisements

LINKED LIST, STACKS AND QUEUES Saras M Srivastava, PGT – Comp. Sc. Kendriya Vidyalaya TengaValley.
CHP-5 LinkedList.
1 DATA STRUCTURES. 2 LINKED LIST 3 PROS Dynamic in nature, so grow and shrink in size during execution Efficient memory utilization Insertion can be.
Data Structure Lecture-5
Data Structure Lecture-3 Prepared by: Shipra Shukla Assistant Professor Kaziranga University.
Ceng-112 Data Structures I Chapter 5 Queues.
WELCOME TO Linked List, Stack & Queue By VINAY ALEXANDER PGT COMPUTER SCIENCE) KV JHAGRAKHAND.
WELCOME TO Linked List, Stack & Queue By Sumit Kumar PGT(CS) KV, Samba.
Chapter Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
Data Structures: A Pseudocode Approach with C
Data Structures & Algorithms
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 17: Linked Lists.
©Brooks/Cole, 2003 Chapter 11 Data Structures. ©Brooks/Cole, 2003 Data Structure Data structure uses collection of related variables that can be accessed.
WELCOME TO Linked List, Stack & Queue By VINAY ALEXANDER PGT COMPUTER SCIENCE) KV JHAGRAKHAND.
Reference: Vinu V Das, Principles of Data Structures using C and C++
UNIT 1 Data Structures Using C Linked List By Rohit Khokher Department of Computer Science, Vidya College of Engineering, Meerut, India.
C++ Programming: From Problem Analysis to Program Design, Second Edition Chapter 17: Linked Lists.
Kovács Zita 2014/2015. II. félév DATA STRUCTURES AND ALGORITHMS 26 February 2015, Linked list.
Subject Name : Data Structure Using C Title : Linked Lists
1. Circular Linked List In a circular linked list, the last node contains a pointer to the first node of the list. In a circular linked list,
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI 240 Elementary Data Structures Linked Lists Linked Lists Dale.
Department of Computer Science 1 Some Practice Let’s practice for the final a little bit. OK?
 Array is a data structure were elements are stored in consecutive memory location.in the array once the memory is allocated.it cannot be extend any more.
Circular linked list A circular linked list is a linear linked list accept that last element points to the first element.
Linked list: a list of items (nodes), in which the order of the nodes is determined by the address, called the link, stored in each node C++ Programming:
Linked List. LINKED LIST Link is collection of similar type of elements. There are two ways of maintaining a list in memory. The first way is store the.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 17: Linked Lists.
C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 18: Linked Lists.
CHAPTER 51 LINKED LISTS. Introduction link list is a linear array collection of data elements called nodes, where the linear order is given by means of.
Fig Storage of a C program. Fig Memory allocation with malloc.
Arrays, Link Lists, and Recursion Chapter 3. Sorting Arrays: Insertion Sort Insertion Sort: Insertion sort is an elementary sorting algorithm that sorts.
UNIT-II Topics to be covered Singly linked list Circular linked list
LINKED LISTS.
© Oxford University Press All rights reserved. Data Structures Using C, 2e Reema Thareja.
Data Structures: A Pseudocode Approach with C 1 Chapter 5 Objectives Upon completion you will be able to: Explain the design, use, and operation of a linear.
LIST Unsorted 1.Set PTR := START 2.Repeat Step 3 while PTR=NULL 3.If ITEM = INFO[PTR], then : Set LOC := PTR and Exit else Set PTR:=LINK[PTR] [PTR points.
C++ Programming:. Program Design Including
Data Structures Using C, 2e
Data Structure By Amee Trivedi.
Stacks and Queues Chapter 4.
Lectures linked lists Chapter 6 of textbook
Program based on queue & their operations for an application
Linked Lists Chapter 6 Section 6.4 – 6.6
Sequences 6/3/2018 9:11 AM Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia,
Data Structure Interview Question and Answers
Data structures and algorithms
Review Deleting an Element from a Linked List Deletion involves:
Prepared by, Jesmin Akhter, Lecturer, IIT, JU
Lecture - 6 On Data Structures
Data Structure Dr. Mohamed Khafagy.
UNIT-3 LINKED LIST.
Linked-list.
EEL 4854 IT Data Structures Linked Lists
Lectures Queues Chapter 8 of textbook 1. Concepts of queue
Queues Chapter 4.
Linked Lists A linked list or one way list is a linear collection of data elements called nodes where the order is given by means of pointers It is divided.
Programmazione I a.a. 2017/2018.
DATA STRUCTURE QUEUE.
Sequences 11/27/2018 1:37 AM Singly Linked Lists Singly Linked Lists.
Linked Lists.
KENDRIYA VIDYALAYA SANGATHAN (AGRA REGION)
Problem Understanding
Chapter 17: Linked Lists.
General List.
Linked Lists.
Linked Lists.
BY PROF. IRSHAD AHMAD LONE.
Chapter 9 Linked Lists.
LINEAR DATA STRUCTURES
Presentation transcript:

LINKED LIST

Linked Lists A Linked List is a linear collection of data elements, called nodes pointing to the next nodes by means of pointers

NEED FOR LINKED LIST Linked List overcome the drawbacks of arrays as in linked list number of elements need not be predetermined, more memory can be allocated or released during the processing as when required ,making insertions and deletions much easier and simpler

TYPES OF LINKED LIST Linked list are of two types:- Singly linked lists: It contains node with single pointer pointing to the next node in sequence Doubly linked list: it contains two pointers, one pointing to previous node and other pointing to the next node in sequence

Singly linked list LIST START 10 20 30 40 Next point of second node Pointer storing the address Of first node Info part

Basic operations on singly linked list Searching Insertion Deletion Traversal Reversal Splitting Concatenation but we will discuss only insertion, deletion and traversal only

Singly linked list Insertion in the beginning of the list 10 20 30 40 New link 5 Represents the status before insertion Insertion in the beginning of the list

Insertion In the beginning of a list Algorithm ptr=START NEWPTR=new node If NEWPTR=NULL Print “no space available ! Aborting !!” Else { NEWPTR  INFO=ITEM NEWPTR  LINK=NULL If START=NULL then START=NEWPTR Save=START NEWPTR - LINK=save } END

Singly linked list Insertion in the end of the list Previously null 10 20 30 40 New link 50 Insertion in the end of the list

Insertion in the end of list Declare pointers START,PTR,NEWPTR,REAR PTR=START NEWPTR=new node If NEWPTR=NULL Print ”no space available !aborting!!!” Exit ELSE { NEWPTR LINK=NULL} If START=NULL THEN { START=NEWPTR REAR=NEWPTR } REAR  LINK = NEWPTR END

DELETION Deletion of item from a linked list involves Search for item in the list If available, make its previous node point to its next node

Singly linked list Deletion of a item from the linked list New link 10 20 30 40 50 ITEM 60 Represents Old links Deletion of a item from the linked list

Deletion from the beginning of list Declare pointers START,ptr If START=NULL then print “underflow” else { Ptr=START START = ptr  LINK Delete ptr } end

Traversal It means processing of all the nodes of the list one by one. the following algorithm prints all the elements of it ptr=start Repeat steps (iii) and (iv) until ptr=NULL Print ptr  INFO Ptr = ptr  LINK end

THANK YOU