Stack implementation with array in Hindi

इस article में हम Stack implementation with array को hindi   व आसान भाषा में जानेंगे ..
तो चलिए start करते हैं……


Stack implementation with array

सबसे पहले stack array को निम्न प्रकार से define किया जायेगा

1. Define the maximum size of the stack variable
I. एक int stack variable को array define कर maximum size declare करना
#define MAXSIZE10
Int stack [MAXSIZE];
2. एक int top को – 1 से intialized किया जायेगा
II. Define the integer variable top and initialized it with – 1


Algorithm for push operation

Let stack [Max size ] is an array for implementing stack.

1. [Enter for stack overflow ?]

If top =MAXSIZE – 1, then : print : overflow and exit.

2. Set Top = Top +[increase top by 1 ]
3. Set STACK [TOP ]:=ITEM [Inset new element]
4. Exit.


Functions for push operation

Void push ( )
{
Int item;
If (top= = MAXSIZE-1)
{
Printf (“stack is full”);
Getch();
Exit(0);
}
Else
{
Printf (“enter the element to be inserted”);
Scanf (“%d”,& item);
Top=top+1;
Stack[top]=item;
}
}


Types of data structure in Hindi ( डेटा स्ट्रक्चर कितने प्रकार के होते हैं।)

डेटा स्ट्रक्चर क्या है। तथा उसके ऑपेरशन।(What is the data structure in Hindi. And its operations.)


Algorithm for deleting an element from the stack

1. [Check for the stack under flow]
If Top<0, then
Printf (“stack under flow”)and exit
eles [remove the top element]
Set item = stack [top]
2. Decrement the stack top
set Top = Top – 1
3. Return the deleted item from the stack .
4. Exit



Function for pop operation

Int pop ()
{
If (top= = – 1)
{
Printf (“the stack is empty”)
Getch();
Exit(0);
}
Eles
{
Item= stack [top];
Top=top-1;
}
Return (item);
}


Note:- ये पोस्ट आपको कैसी लगी आप कमेंट कर के बताईये !अगर आपको कुछ पूछना या अपनी राय देनी  हो तो आप हमे कमेंट या [email protected] ईमेल करके बता सकते है हम पूरी कोसिस करेंगे की आपका रिप्लाई जल्दी से जल्दी दे सखे ….


इसे भी देखे:

Hello दोस्तों! नीचे दिए गए links पर click  करके आपको हम  इस पोस्ट में  (Computer Online Test) की Practice कराएंगे जिससे आप अपने  CCC, O level , कम्प्युटर GK की practice कर सकते है.

इस post के द्वारा आप  अपनी कम्प्युटर की  नॉलेज बड़ सकते है.

उसके साथ ही साथ आप अपने कई प्रकार के पेपरो की भी तैयरी  भी कर सकते है.

जैसे की CCC, O level , कम्प्युटर GK की practice कर सकते है,

 

2 thoughts on “Stack implementation with array in Hindi”

Leave a Comment