Explain PUSH and POP operation
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
PUSH और POP ऑपरेशन्स स्टैक (Stack) डेटा संरचना से संबंधित हैं। स्टैक एक LIFO (Last In, First Out) डेटा संरचना है, जिसका मतलब है कि अंतिम डेटा तत्व (जो आखिरी में डाला गया हो) पहले निकाला जाएगा। इन ऑपरेशन्स का उपयोग स्टैक के डेटा को जोड़ने और निकालने के लिए किया जाता है।
1. PUSH Operation (पुश ऑपरेशन):
कार्यप्रणाली:
उदाहरण: मान लीजिए स्टैक का प्रारंभिक स्थिति खाली है:
[]
PUSH(5)
ऑपरेशन करते हैं, तो स्टैक ऐसा दिखेगा:[5]
PUSH(10)
करते हैं, तो स्टैक दिखेगा:[5, 10]
2. POP Operation (पॉप ऑपरेशन):
कार्यप्रणाली:
उदाहरण: मान लीजिए स्टैक है:
[5, 10]
POP()
ऑपरेशन करते हैं, तो स्टैक से शीर्ष तत्व (10) निकाला जाएगा और स्टैक दिखेगा:[5]
POP()
ऑपरेशन करते हैं, तो स्टैक से 5 भी निकाला जाएगा, और स्टैक खाली हो जाएगा:[]
निष्कर्ष:
इन दोनों ऑपरेशन्स का उपयोग स्टैक संरचना को संचालित करने और उसका प्रबंधन करने के लिए किया जाता है।