Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Summary

Summary of Linked List Subject Code-Kcs301

Rating
-
Sold
-
Pages
10
Uploaded on
27-02-2023
Written in
2022/2023

Introduction of Linked list Creation and Traversal in C language Insertion of nodes Circular Linked List Doubly Linked List Introduction to Stack in Data Structure

Institution
Course

Content preview

Introduction in Linked List
With a very good example i will show what is linked list and why would you like to use it. The
name of linked list is the name of a linked list , if you 're listening for the very first time and it
is possible that you 've read it before and did n't understand that i will start with and example
to explain this thing and the example will be of a hospital. In every hospital each single bed
was utilized utilized utilized them so this is linked list. The advantage we got here is that we
could n't get all the beds at the same place. The size of our array can be so large that we do
n't know2 today these are 7 tomorrow these may be 7 lakhs even then if we want to allocate
memory if the array of 7 expands or if the capacity of array is low then it will be a problem. In
linked list it has a node which has a space for data one is for pointer to next and another one
for pointer. This too will run like this and point to the next node so here as you remember the
example of the hospital how did I gave the analogy that i just gave an example to explain. To
extend this list is very easy to extend this is not easy and sometimes impossible too.

LinkedList is just like a chain it is a chain with hooks. Inserting and deletion in linked list is so
easy as much as is to interconnect two links. If you would have created an array you do n't
get the luxury to remove this how will you remove this element this is contiguous memory
location you have to move it only or else they wont be there. for no use array has its own
benefit and this is advantageous there this one is not and where this is not advantageous
there is not. Let's see where which to use and which one will give you advantage and when
assume that if you want to access the elements like this 4 element 8th or 9th element so you
can access in constant time do you have this pointer assume this pointer how much you
have to join to get the access the ptr. The address is 280 so in this 280 is there and is
pointing that point does n't mean that it is done by a finger it means in this the address is
kept stored i will do and show you by coding it. The drawbacks of array are the linklist shines
over here have written the thing completely short crisp and to the point are not lengthy notes
at all which means short crisp.

In linked list the memory and capacity are the same in linked list you can join the nodes and
remove nodes from the mid does n't matter in array. In array and linked list we have seen
that the memory is the same. In linked lists elements are there in non contiguous memory
location if it is 0 then it can be 2000 or 4000 and then the next node can be again 40
anywhere. i hope you all have got the idea of linked list and in next video i will explain
implementation implementation. i would request again please do share this playlist not just
for saying please do it only two people shared this playlist and i 've tagged both of them and
if you share this i will tag to you people too tag and share this.
Creation and Traversal in C Language

Friends, in this course of data structure , we had seen the linked list in the previous video.
We had seen what is needed : linked list , why we need linked list, what will be the benefit of
doing linked list. After that we will see that how the same linked list can be traversed.
Pointing means that it is a variable and this is its address. If its address is let 's say 788 ,
then 788 is stored inside it. If a pointer stores the address of another struct Node here , I
would say it is pointing to this struct Node. Then I 'll declare the end of this list here , okay. I
was getting a lot of comments in such a way that I repeat things sometimes so I will not
repeat here now , I will point you here at the place where you people will find the arrow
operator. To access the data of the struct pointer , you can use the arrow operators. To see
if you want head data then you can simply use arrow operator like this

, So let 's go to the VS code , and in C language , to see the creation and traversal of linked
list. Here as if this is your one node , after that it is linked as if with some other node. And
then you 'll have another node over here , and the pointer to this one will be linked to that
node. and so on until your null comes. So traversal 's time complexity is O ( n ) because if n
nodes are in the list then (n ) times you are travelling the list. A 14_LinkedListTraversal. c
template was created. The video number is going to be 14. So if I talk about the video
number , then by opening the playlist , the song will be the number 14. I create a file with the
names of it, and put a boiler plate in it. I will define my structure here. How can we make a
function of linked list traversal ? What do I do to make function of traversal of linked lists?
What will happen that with the help of this pointer , I will print the elements inside the whole
list one by one. How will it be possible ? It should be possible that first my pointer will point to
the head node then after that I will find the element next to the. head node. So what will it
take , this is just what I want ( struct Node * ptr ) i need pointer I want a pointer that is of type
Node * And it 's pointing , where at the head.

So to linked list traversal , I have given a pointer which is of type struct Node * : I get one. I
will print the data and find that next node and run that data. And I 'll keep doing this until it
becomes null until it points to null. I did n't even call this function. Head is a pointer, of struct
Node * type So over here this is , struct Node* ptr Okay So what will I do here , I save it and
run it. And you guys see , Element 7, Element 11, Element 66 and Element 66. If it also had
a fourth node if it also has a fourth, i. e. I would put some data in the third node. And I have
n't made the fourth , so I have to make the fourth. So look , made the head made the
second, made the third and made the. fourth. This is the last element of the list because the
next one is pointing to NULL So here is the chain , it 's closed Sometimes I had to add an
element , can do it at any location. So I would just like to say that you guys here of four
element , five element, five element , 10 element here are able to make linked list of it.
Relatively , very few people have access to this playlist I would say by bookmark it and save
it.

Only 1 or 2 people are coming forward to share the course in Data Structures. So far
maximum 2-3 people must have done so if you do then thank you so much. Do n't forget to
tag me Below I have given the link of my Instagram in the pin comment.

Insertion of Node in a Linked List

The Insertion and Deletion all this is going to come in linked list , it 's all very easy. It is Insert
after and we will also talk about their complexity. What we are going to do is simple in a way
to understand the problems of C programming. Head node is pointing to the first element of
my linked list. I get access to linked list , with the help of head node. I have to fit it in the
starting. How do i have to do to do this , you think for yourself First of all, what will I do to link
it , something like this. There are 5 lakh elements, so how much time is it taking , is it
increasing , if it is increasing , then because of what fear is increasing, that is time
complexity. No matter how many elements you are ahead of here , it has not even seen the
element. It is not depending on ( n ) at all And but when it does n't depend on (n), we had
already seen in the lesson.

Written for

Institution
Course

Document information

Uploaded on
February 27, 2023
Number of pages
10
Written in
2022/2023
Type
SUMMARY

Subjects

$18.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
mridulpbh4050

Get to know the seller

Seller avatar
mridulpbh4050 IMS Engineering College
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
3 year
Number of followers
0
Documents
3
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions