Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
393 views
in Computer by (55.2k points)
closed by

स्टैक ऑपरेशन को विस्तार से समझाइए।

1 Answer

+1 vote
by (57.2k points)
selected by
 
Best answer

स्टैक ऑपरेशन- स्टैक ऑपरेशन का उपयोग स्टैक को इनिशलायजिंग और डीइनिशलायजिंग करने के लिए किया जाता है। इसके अलावा एक स्टैक निम्नलिखित दो प्राथमिक कार्यों के लिए प्रयोग किया जाता है

Push () – एक तत्त्व स्टैक में जोड़ना
Pop () – एक तत्त्व स्टैक से हटाना

पुश ऑपरेशन (Push Operation) – स्टैक में एक नया डेटा तत्त्व जोड़ने या डालने की प्रक्रिया को पुश ऑपरेशन कहते है। पुश ऑपरेशन निम्नलिखित स्टेप्स की एक श्रृंखला है।

Step 1 – Checks if the stack is full.
Step 2 – If the stack is full, produces an error and exit.
Step 3 – If the stack is not full, increments top to point next empty space.
Step 4 – Adds data element to the stack location, where top is pointing.

Stack Step 5 – Returns success.

यदि स्टैक का लिंक लिस्ट से इम्पलीमेंट करते है तो स्टेप 3 में डायनामिक मैमोरी आवंटित करनी होगी।

पॉप ऑपरेशन (Pop Operation) : स्टैक से एक डेटा तत्त्व को हटाने की प्रक्रिया को पॉप ऑपरेशन कहते है। जब पॉप ऑपरेशन को एक ऐरे की मदद से इम्पलीमेंट करते है तो वास्तव में डाटा तत्त्व को हटाने की बजाए टॉप वेरिएबल को एक से घटते है जबकि लिंक लिस्ट से इम्पलीमेंट करने पर वास्तव में डाटा तत्त्व को हटा कर मैमोरी को deallocates किया जाता है। पॉप ऑपरेशन निम्नलिखित स्टेप्स की एक श्रृंखला है

Step 1 – Checks if the stack is empty.
Step 2 – If the stack is empty, produces an error and exit.
Step 3 – If the stack is not empty, accesses the data element at which top is pointing.
Step 4 – Decreases the value of top by 1.
Step 5 – Returns success.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...