हिंदी माध्यम नोट्स
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
सती रासो किसकी रचना है , sati raso ke rachnakar kaun hai in hindi , सती रासो के लेखक कौन है
सती रासो के लेखक कौन है सती रासो किसकी रचना है , sati raso ke…
मारवाड़ रा परगना री विगत किसकी रचना है , marwar ra pargana ri vigat ke lekhak kaun the
marwar ra pargana ri vigat ke lekhak kaun the मारवाड़ रा परगना री विगत किसकी…
राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए sources of rajasthan history in hindi
sources of rajasthan history in hindi राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए…
गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है ? gurjaratra pradesh in rajasthan in hindi
gurjaratra pradesh in rajasthan in hindi गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है…
Weston Standard Cell in hindi वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन
वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन Weston Standard Cell in…
polity notes pdf in hindi for upsc prelims and mains exam , SSC , RAS political science hindi medium handwritten
get all types and chapters polity notes pdf in hindi for upsc , SSC ,…