हिंदी माध्यम नोट्स
Stack : General Information in c language in hindi , स्टैक क्या है c कंप्यूटर भाषा में हिंदी में
किसी linked list को stack से implantation करना सबसे सरल operation होता है |इसके दो प्रकार होते है :-
1. linked लिस्ट item
2. constructor
linked लिस्ट मे ,stack element की लिए item field होती है और address के लिए address feild होती है |constructor मे same लिस्ट का copy होता है जो की stack operation मे मदद करता है |
किसी भी linked लिस्ट मे , data को add लिस्ट के top पर कराया जाता है|और पहले वाला top अब next बन जाता है जो की लिस्ट मे add किये जाने item को point करता है |और add item इस लिस्ट का नया top बन जाता है |इसका अल्गोरिथ है :-
function push(item)
{
list_pre(item);
end function
}
list_pre(item); function मे top को check किया जाता है इसके लिए निन्म function को use किया जाता है :-
function top()
{
return list.begin.getvalue ()
}
अगर किसी item को delete किया जाता है तब linked list के first node को डिलीट किया जाता है |इसके लिए algorithmहै :
function pop()
{
remove_listfirst();
इसके बाद लिस्ट के emptyness को सजहेस्क किया जाता है |जिसे
function empty ()
{
return (empty () );
}Performance Analysis
linked लिस्ट मे ,लिस्ट के first element को access करने o(1) operation करना पड़ता है|लिस्ट एक pointer को contain करता है जो की लिस्ट के emptyness और fullness को check करता है |कसी बार यूजर getsize(0 function को use नहीं करते है जिससे की मेम्रोरी space को बचाया जा सकता है |लेकिन memory space को optimize नहीं कर सकते है |
सभी stack operation के लिए array implemetation better रहता है क्योकि
array impleminatation मे , array के first element को stack का last element होता है |जैसे जैसे arrayबढेगी ,stack मे age और की बढ़ते है |इस impleminatation मे एक ही प्रॉब्लम होती है की अगर array फुल होती है तो डट को add नहीं किया जा सकता है |
Application
1.Convert decimal number into binary number
किसी decimal number को binary number मे convert काढ़े का अल्गोरिथ है :-
1. input number
2. while loop को चलाया जाता है
3. number को 2 से डिवाइड किया जाता है (Loop की body ) और qucent को number मे save करते है |
4. reminder को print किया जाता है | और qucent को 2 से डिवाइड करते है |
5. step 3,4 tab तक चलता है जब तक number की value 0 से ज्यादा होती है |
लेकिन इस लॉजिक की एक प्रॉब्लम है जसिसे अगर number 23 है जिसे binary number मे convert करना है इसका आउटपुट आएगा 11101 लेकिन actual मे आउटपुट 10111 होगा|
इस प्रोब्लेम को solve करने के लिए stack का use किया जाता है |सबसे पहले हम reminder को stack मे insert करते है |जब devision क्कोम्प्लेते हो जाट अहै |stack मे store digits को बहार निकाल print कर देते है|
इसकी अल्गोइरिथ्म है :-
1.stack को create करेगे |
2.decimal number को input करेगे |
3.फिर while loop चलेगे |loop की body मे .
3.1 binary =number % 2
3.2 push binary into stack
3.3 अगर stack फुल है तब error message print हो जाये गा और algorithm terminate हो जायेगा |
3.4 divid number by 2 और store qucent into number
4. step 3 को tab तक repeat करगे जब तक number की value ‘0’ से ज्यादा है |
5.while loop को चलायेगे |loop की body मे ,
5.1pop binary from stack
5.2 binary को print करायेगे |
6. loop तब तक चलेगा जब तक की stack empty नहीं हो जाता है |
7 stop
इसके अलावा stack को कई दुसरे appliaction होते है जैसे :-
1. Tower ऑफ़ honio
2. Expression Evalution
3. Syntax Parsing
4. Rearranging rail road cars
5. Stock Span Problem
इन सभी प्रोब्लेम्स को सार से हम आगे आने वाले articles मे पढेगे|
Recent Posts
Question Tag Definition in english with examples upsc ssc ias state pcs exames important topic
Question Tag Definition • A question tag is a small question at the end of a…
Translation in english grammer in hindi examples Step of Translation (अनुवाद के चरण)
Translation 1. Step of Translation (अनुवाद के चरण) • मूल वाक्य का पता करना और उसकी…
Report Writing examples in english grammer How to Write Reports explain Exercise
Report Writing • How to Write Reports • Just as no definite rules can be laid down…
Letter writing ,types and their examples in english grammer upsc state pcs class 12 10th
Letter writing • Introduction • Letter writing is an intricate task as it demands meticulous attention, still…
विश्व के महाद्वीप की भौगोलिक विशेषताएँ continents of the world and their countries in hindi features
continents of the world and their countries in hindi features विश्व के महाद्वीप की भौगोलिक…
भारत के वन्य जीव राष्ट्रीय उद्यान list in hin hindi IAS UPSC
भारत के वन्य जीव भारत में जलवायु की दृष्टि से काफी विविधता पाई जाती है,…