JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

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

Categories: C Language in hindi

Stack : General Information in c language in hindi , स्टैक क्या है c कंप्यूटर भाषा में हिंदी में

स्टैक क्या है c कंप्यूटर भाषा में हिंदी में , Stack : General Information in c language in hindi  :-
Stack एक basic data struture है data को stack/piles के linear arrangement मे store किया जाता है |और इस data structure मे , data को stack के top मे से insert / delete कर सकते है|stack के struture को समज़ने के लिए उदाहरण है एक के एक उपर books का arrangement |जिसमे नै book को add और delete arrangement के top से किया जाता है |
अतः stack जिस concept पर आधारित है उसे LIFO (last in first out) कहते है |इस article मे , stack के basic operations को देखगे जैसे data को access करना |data की insert करना |data को delete करना आदि |
1.Push () : इस function का use किसी नए element को stack मे add किया जाता है |अतः किसी नए element को stack मे add कराने की प्रोसेस को push कहते है |
2.pop() :  इस function का use किसी नए element को stack मे remove किया जाता है |अतः किसी नए element को stack मे हटाना की प्रोसेस को pop कहते है |
3.is-empty() : इस function का use stack का status check किया जाता है |
अगर function ‘1’ return करे तब stack मे कोई element नहीं है |
और ‘0’ return करे तब stack मे element है |
4.is-full () : इस function से stack का status check किया जाता है |
अगर function ‘1’ देता है तब stack मे कोई नया element push नहीं हो सकता है |
अन्यथा stack मे element  add हो सकता है |
5.getsize () : इस function से , stack मे उपस्थित element की सख्या को return किया जाता है |
सभी functions, getsize() के अलावा  की time complexity O(1) होती है |और getsize() function की time complexity in worest case मे O(n) होती है |
Stack implantation by linked list

किसी 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 मे पढेगे|

Sbistudy

Recent Posts

सती रासो किसकी रचना है , sati raso ke rachnakar kaun hai in hindi , सती रासो के लेखक कौन है

सती रासो के लेखक कौन है सती रासो किसकी रचना है , sati raso ke…

21 hours ago

मारवाड़ रा परगना री विगत किसकी रचना है , marwar ra pargana ri vigat ke lekhak kaun the

marwar ra pargana ri vigat ke lekhak kaun the मारवाड़ रा परगना री विगत किसकी…

21 hours ago

राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए sources of rajasthan history in hindi

sources of rajasthan history in hindi राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए…

3 days ago

गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है ? gurjaratra pradesh in rajasthan in hindi

gurjaratra pradesh in rajasthan in hindi गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है…

3 days ago

Weston Standard Cell in hindi वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन

वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन Weston Standard Cell in…

3 months ago

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 ,…

3 months 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