What is Stack Data Structure in Hindi
Stack Kya hota hai : स्टैक एक linear data structure है जो data ऑपरेशन परफॉर्म (डाटा एलिमेंट ऐड एंड रिमूव) करने के लिए एक particular sequential आर्डर फॉलो करता है। जहाँ पर नए आइटम का addition एवं रिमूवल हमेशा same एन्ड से होता है। इस एन्ड पॉइंट of commonly “top” के नाम से एंड दूसरे अपोजिट एन्ड को बेस नाम से जाना जाता है। स्टैक का बेस आइटम सबसे जयदा टाइम तक रहने वाला एलिमेंट होता है क्योकि यह सबसे पहले add कर दिया जाता है एवं इसको सबसे बाद मे निकला जा सकता है। स्टैक मे सबसे कम समय तक रहने वाला एलिमेंट top एलिमेंट होता है जो की सबसे recently ऐड किया हो। इस आर्डर को LIFO, last-in first-out कहते है| इसका मतलब सबसे बाद मे add होने वाला एलिमेंट सबसे पहले निकला जाता है। इसको FILO(First In Last Out) भी कहा जा सकता है ।
Stack टर्मिनोलॉजी मे addition ऑपरेशन को PUSH ऑपरेशन एवं रिमूवल ऑपरेशन को POP ऑपरेशन कहते है। जब stack का top एलिमेंट delete किया जाता है तो (स्टैक के खाली होने तक ) top के नेक्स्ट वाला एलिमेंट top element बन जाता है।
Read Also – What is Object Oriented Programming
Read Also – What is Polymorphism
Read Also – What is C Programming language
Read Also – What is OOPs
एक real life example होगा –
जब भी आप stack of trays or plates देखते है एवं आपको एक प्लेट लेनी होती है तो आप सबसे ऊपर वाली (टॉप) प्लेट सबसे पहले उठाते है एवं उसके बाद नेक्स्ट प्लेट्स। सबसे निचे रखी गयी प्लेट सबसे बाद मे उठायी जाती है जिसे बेस प्लेट कहा जायेगा|
Stacks features –
- यह एक डायनामिक डाटा स्ट्रक्चर है।
- इसका कोई एक fixed साइज नहीं होता।
- यह एक fixed amount of मेमोरी खर्च नहीं करता।
- स्टैक का साइज हर push() एंड pop() ऑपरेशन के बाद चेंज होता है|
Stack basic operations-
- Push: स्टैक मे एक आइटम ऐड करता है। अगर स्टैक फुल होता है तो इसका Overflow कंडीशन कहते है।
- Pop: स्टैक से एक आइटम को रिमूव करता है। अगर स्टैक खाली होता है तो इसको Underflow कंडीशन कहते है।
- Peek or Top: टॉप एलिमेंट हो एक्सेस करता है।
- isEmpty: अगर स्टैक खाली होता है तो true, नहीं तो false वैल्यू देता है।
Push Operation स्टेप्स –

Stack push operation
- Step 1 − सबसे पहले stack के स्टेटस को चेक किया जाता है की ये भरा हुआ तो नहीं है।
- Step 2 − अगर स्टैक फुल होता है तो यह एरर मैसेज दे कर exit कर जाता है ।
- Step 3 − अगर स्टैक full नहीं है तो टॉप को डाटा एलिमेंट को ऐड करके top की वैल्यू को एक increment कर देता है।
- Step 4 − ऑपरेशन कम्पलीट होता है ।
Pop operation स्टेप्स −

stack in data structure pop operation
- Step 1 − चेक करता है की स्टैक खाली तो नहीं ।
- Step 2 − अगर स्टैक खाली है तो एरर मैसेज दे कर exit करता है ।
- Step 3 − अगर स्टैक खाली नहीं है तो top डाटा एलिमेंट को access करता है ।
- Step 4 − Top वैल्यू को एक कम कर देता है ।
- Step 5 − ऑपरेशन कम्पलीट होता है ।
Implementation तरीके : – Two ways –
- Using array
- Using linked list
Read Also – What is Queue in data structure
Read Also – What is Programming language
Click here to read Differences between C and C++ Programming Languages
Read Also – What is Data Structure
Read Also – What is Linked List
Read Also – What is Array
Amit sir mera name tanushka saxena he hame algoritha for data structure in Hindi me chaiye he plz sir help me