JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

हिंदी माध्यम नोट्स

Categories: C Language in hindi

Linked Lists in hindi in c language , what is Linked Lists in c , c भाषा में लिंक्ड लिस्ट क्या है हिंदी में

c भाषा में लिंक्ड लिस्ट क्या है हिंदी में Linked Lists in hindi in c language , what is Linked Lists in c :-
हमने इससे पहले के article मे सभी data type को स्टूडे किया अब आने वाले article मे कुछ advanced data structure जैसे linked list,stack और queues को पढेगे |
जिसे की array भी एक लिस्ट है |array मे ,data को sequential collection है जिसमे data को index से accessing और manipulation का सकते है |लेकिन अर्रा में ,array की size को compile time पर declare करना होता है |जो की कई बार मुश्किल हो जाता है |इस प्रॉब्लम को solve करने के लिए एक नए data structure को introduce किया गया है |
Linked List
linked list एक एसी data structure है जिसमे data structure के item के अलावा lost मे आने वाले next item के address को contain किया जाता है |इस data structure को linked list इसलिए कहते है क्योकि इसमे list के सभी item आने वाले item से link होते है |
linked लिस्ट के प्रत्येक block को नोड कहते है |जिसके दो part होते है :-
1.पहले भाग linked लिस्ट के item को रखता है |
2.दुसरे भाग मे ,next item के address को रखता है |

इस data structure मे element , memory address से link नहीं होते है बल्कि किसी लॉजिकल लिंक से लिंक होते है जो की सभी नोड के दुसरे भाग मे store होता है |लिंक एक pointer variable होता है जिसका type दुसरे नोड के data type का होता है |linked लिस्ट को structure data type से define किया जाता है जिसका syntax है :-

struct node
{
int item;
struct node *next ;
};
इस syntax मे :-
1. item : item एक integer variable है जो की linked लिस्ट के element को रखता है |
2. next : next एक pointer variable है जो की linked लिस्ट के next element के address को contain करता है |इसका data type struct node होता है |
इस तरह की structure जो की members फ़ील्ड मे एसे member को रखते है जिसका data type ,खुद का data type होता है |ये structure self referential structure कहते है |
किसी नोड का syntax होता है :-
struct node
{
mem 1;
mem 2;
……….;
……….;
struct node *pointer_name ;
};
एक उदाहरन लेते है :-
struct node
{
int salary;
struct node *n;
};
ये एक linked list के node का declartion है |अब उसके बाद ,node1 और node2 दो नोड है जिसका data type struct node है |
इसे declare करेगे :-
struct node node1 ,node2 ;
इस statement से दो space create हो जायेगे जिसमे से एक space पहले node के item को और दुसरे node के address को contain करेगा |और दूसरा node ,दुसरे node का  item को तीरसे node के address को contain करता है |
अतः node1.n=&node2; अगला statement होगा जो की linked लिस्ट  की condition को follow करता है |
उसके बाद :
node1.salary=2000;
node2.salary=4500;
इन statement से , दो node के item वाले space मे 2000 और 4500 assign हो जायेगा |
अगर इस लिस्ट मे अगला node add होगा तब node2.n=&node3; statement से node3 का address node2 के pointer variable मे store हो जाता है |
अगर किसी लिस्ट का end हो जाता है  इस लिस्ट के last वाले element के pointer variable मे null pointer ‘0’ को store होता है | अतः node2.n=0;
किसी linked लिस्ट के element को access करने के लिए printf(“%d”,node1.n->salary); use कर सकते है |
Linked list : advantage और disadvantage :-
1.लिंक लिस्ट एक dynamic data type है इसे प्रोग्राम के run time के समय declare किया जा सकता है |मतलब इसके size को कम और ज्यादा run time के समय किया जा सकता है |
2.इस डट type से memory wastage नहीं होती है |ये memory को तभी use करता है जब इसे उसकी जरुरत होती है |अनावश्यक memory को होल्ड नहीं करता है |
3.सबसे महत्वपूर्ण advantage होता है की linked list की flexibility |इसका मतलब है की linked लिस्ट के किसी भी element को कभी भी rearrange कर सकते है |
Disadvantage
1,linked लिस्ट की सबसे पहले disadvantage है की item के random access complex और time consuming होता है |
2.अगर हम fixed length linked list को use करते है linked list सेअच्छा array होती है क्योकि linked लिस्ट से data को process करना मुश्किल होता है |
Sbistudy

Recent Posts

मालकाना का युद्ध malkhana ka yudh kab hua tha in hindi

malkhana ka yudh kab hua tha in hindi मालकाना का युद्ध ? मालकाना के युद्ध…

4 weeks ago

कान्हड़देव तथा अलाउद्दीन खिलजी के संबंधों पर प्रकाश डालिए

राणा रतन सिंह चित्तौड़ ( 1302 ई. - 1303 ) राजस्थान के इतिहास में गुहिलवंशी…

4 weeks ago

हम्मीर देव चौहान का इतिहास क्या है ? hammir dev chauhan history in hindi explained

hammir dev chauhan history in hindi explained हम्मीर देव चौहान का इतिहास क्या है ?…

4 weeks ago

तराइन का प्रथम युद्ध कब और किसके बीच हुआ द्वितीय युद्ध Tarain battle in hindi first and second

Tarain battle in hindi first and second तराइन का प्रथम युद्ध कब और किसके बीच…

4 weeks ago

चौहानों की उत्पत्ति कैसे हुई थी ? chahamana dynasty ki utpatti kahan se hui in hindi

chahamana dynasty ki utpatti kahan se hui in hindi चौहानों की उत्पत्ति कैसे हुई थी…

1 month ago

भारत पर पहला तुर्क आक्रमण किसने किया कब हुआ first turk invaders who attacked india in hindi

first turk invaders who attacked india in hindi भारत पर पहला तुर्क आक्रमण किसने किया…

1 month ago
All Rights ReservedView Non-AMP Version
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings
JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now