हिंदी माध्यम नोट्स
Queues : Basic in c language in hindi , what is Queue in c , c कंप्यूटर भाषा में क्यु क्या है हिंदी में
Queues मे data को Queues के front मे add किया जाता है और data को डिलीट को Queues के end मे से किया जाता है |Queues मे जहा से add operation perform होता है उसे front कहते है |और जहा से डिलीट operation perform होगा use rear कहते है |
किसी Queues को define करने के लिए निन्म variable को use किया जाता है :-
1.Queues[] : ये array होती है जो की Queues के तरह कार्य करेगी
2.size: ये Queues array की size होती है |
3.front : ये Queues का front भाग होता है जहा से insert operation perform होता है |
4.rear : ये Queues का पीछे वाला भाग होता है जहा से डिलीट operation perform होता है |Queues मे निन्म operation perform हो सकते है :-
1.EnQueues
इस function मे Queues मे data को add किया जाता है |अगर Queues फुल होती है तब इसे overfull condition कहते है |इसकी algorithm है :-
1.सबसे पहले rear की value check होती है |
2 अगर rear की value arraysize से सामान होती तब
2.i-overfull condition का message आ जाता है \
2.ii-अन्यथा Queues के rear position पर item insert हो जाता है और Queues के rear की position बढ़ जाती है |
इस operation की complexity O(1) होती है क्योकि इसमें एक ही बार operation होता है |
2.DeQueues
इस function का use , Queues से data को डिलीट करने के लिए किया जाता है |अगर Queues empty है तब underflow condition आ जाती है |इसकी algorithm है :-
1.सबसे पहले condition check की जाती है |
2.अगर Queues का front और rear की value same होती है तब
2.i underflow condition आ जाती है |
2.ii-Queues के front पोसितिओंके element को ‘0’ से रिसेट कर देते है |और front को एक position से decrement कर देगे |
3.front()
इस function मे Queues के front position पर उपस्थित element को return किया जाता है |अगर Queues array का नाम Queues[] है तब
int front(Queues[])
{
return(Queues[front]);
}
4.Size ()
इस function का use , Queues की size को calculate करने के लिए किया जाता है |अगर Queues array का नाम Queues[] है जिसमे
front : जो की Queues[] के first position की value को contain करता है |
rear : ये Queues[] के last position की value को contain करता है |
तब Queues की size = rear-front;
size(int rear,int front)
{
size =rear-front;
return(size);
}
5.is empty ()
ये function Queues के status को check करता है |अगर function ‘1’ return करे तो Queues empty है |अन्यथा Queues मे element है |
Double Ended Queues
Queues दो प्रकार की होती है इस article मे केवल Double Ended Queues को पढेगे |Circular Queues के लिए एक अलग से chapter उपलब्ध है |
single Queues मे,कोई भी data Queues के front से डिलीट होता है और insert Queues के rear होता है |लेकिन Double Ended Queues मे data दोनों side ( front या rear ) से insert और डिलीट हो सकता है |इसलिए इसे Double Ended Queues भी कहते है |
Double Ended Queues मे निन्म operation perform हो सकते है :-
1.insert at back side
इस operation की algorithm,Queues की enQueues के तरह होती है | इसकी algorithm है :-
1.सबसे पहले rear की value check होती है |
2 अगर rear की value arraysize से सामान होती तब
2.i-overfull condition का message आ जाता है |
2.ii-अन्यथा Queues के rear position पर item insert हो जाता है और Queues के rear की position बढ़ जाती है |
2.Delete from back
इस operation के लिए algorithm होती है :-
1.condition check की जाती है |
2.अगर front और rear की value same होती है तब
2.i- underflow की condition आ जाती है |
2.ii-अन्यथा rear को rear-1 से set करते है और Queues के rear position पर ‘0’ को assign करते है |
3.Insert at front
इस operation के लिए algorithm होती है :-
1.condition check की जाती है |
2.अगर front की value 1 होती है तब
2.i- item can not add का message आ जाता है |
2.ii-अन्यथा front को front -1 से set करते है और Queues के front position पर data assign करते है |
4.Delete at front
इस operation की algorithm,Queues की enQueues के तरह होती है | इसकी algorithm है :-
1.सबसे पहले front की value check होती है |
2 अगर rear और front की value सामान होती तब
2.i-overfull condition का message आ जाता है |
2.ii-अन्यथा Queues के front position पर item insert हो जाता है और Queues के front की position बढ़ जाती है |
5.front()
इस function मे Double Ended Queues के front position पर उपस्थित element को return किया जाता है |अगर Queues array का नाम Queues[] है तब
int front(Queues[])
{
return(Queues[front]);
}
int front(Queues[])
{
return(Queues[rear-1]);
}
इसके अलावा size() और is empty () function भी perform होते है |जिसकी algorithm नार्मल Queues की तरह होती है |
Recent Posts
मालकाना का युद्ध malkhana ka yudh kab hua tha in hindi
malkhana ka yudh kab hua tha in hindi मालकाना का युद्ध ? मालकाना के युद्ध…
कान्हड़देव तथा अलाउद्दीन खिलजी के संबंधों पर प्रकाश डालिए
राणा रतन सिंह चित्तौड़ ( 1302 ई. - 1303 ) राजस्थान के इतिहास में गुहिलवंशी…
हम्मीर देव चौहान का इतिहास क्या है ? hammir dev chauhan history in hindi explained
hammir dev chauhan history in hindi explained हम्मीर देव चौहान का इतिहास क्या है ?…
तराइन का प्रथम युद्ध कब और किसके बीच हुआ द्वितीय युद्ध Tarain battle in hindi first and second
Tarain battle in hindi first and second तराइन का प्रथम युद्ध कब और किसके बीच…
चौहानों की उत्पत्ति कैसे हुई थी ? chahamana dynasty ki utpatti kahan se hui in hindi
chahamana dynasty ki utpatti kahan se hui in hindi चौहानों की उत्पत्ति कैसे हुई थी…
भारत पर पहला तुर्क आक्रमण किसने किया कब हुआ first turk invaders who attacked india in hindi
first turk invaders who attacked india in hindi भारत पर पहला तुर्क आक्रमण किसने किया…