What is stack in data structure

 

Stack in Data Structure

In computer science, a stack is a linear 

data structure that follows the Last-In-

First-Out (LIFO) principle. This means 

that the last item added to the stack is 

the first one to be removed. Think of it 

like a stack of plates – you can only 

remove the top plate.

Operations on a stack typically 

include 

"push," which adds an item to the top 

of the stack, and "pop," which removes 

the top item. It's a fundamental 

concept used in various programming 

scenarios, such as managing function 

calls, tracking execution history, and 

solving problems involving nested 

structures.

 Stack ek computer science mein 

istemal hone wala linear data 

structure hai, jiska "Last-In-First-Out" 

(LIFO) principle follow hota hai. Iska 

matlab hai ki jo item sabse akhir mein 

stack mein add kiya gaya hai, woh 

pehle nikala jata hai. Isko aise 

dekhein 

jaise ek pile of plates ho - aap sirf upar 

wali plate ko nikal sakte hain.

Stack par amalat usually "push" aur 

"pop" include hote hain. "Push" 

operation se ek item stack ke upar add 

hota hai, aur "pop" operation se upar 

wala item nikala jata hai. Ye mool taur 

par various programming scenarios 

mein istemal hota hai, jaise function 

calls ko manage karna, execution 

history ko track karna, aur nested 

structures se mutalliq 

masail ko hal karna.





Post a Comment

0 Comments