Stacks and Queues in Data structure in hindi

Stack Kya hai

stack Ek non-primitive linear data structure hota hai jisme kisi new Data item ko jodna or pahle se present data item ko delete karne ka kaam stack ke ek end se kiya jata hai jise stack ka top kahte hai.

Esi top se sabhi data items ka insertion aur deletion kiya jata hai stack me jo data item last me add hota hai vh deletion ke time sabse pahle delete hota hai. Esi reason se ese Last-In-First-Out(LIFO) kaha jata hai.

Ex-1.Stack of plates in a marriage party or coin stacker.jaha par fresh plate top par rakha jata hai aur top se hi plates remove kiya jata hai.

Ex-2.ydi hum biscuits ya poppins khate hai par dono ke ek chhor ko open karke ek-ek karke biscuits aur Poppins ko nikalte hai yha par bhi stack ki property ko use kiya jata hai

Basic Features of Stack

  1. Stack ek hi tarah ke data types Ka sequential collection hota hai
  2. Stack ek last-in-first-out type ka data structure hai
  3. Stack me data item Ko insert karne ke liye PUCH() function ka use kiya jata hai jabki Delete karne ke liye POP() function ka.Dono insertion aur deletion karne ke liye keval Ek End ka prayog kiya jata hai jisko Top of stack kahte hai
  4. Ydi kisi stack ki size puri tarah full hai to data item ko add(insertion) karte time overflow State ban jata hai jabki ek aisa state bhi aata hai jab stack me koi bhi data item nahi hota hai vh state underflow kahlata hai.

Application of Stack

  1. Reversing a string...

    Kisi string ko Reverse karne ke liye stack ka use kiya jata hai

    Example:-Ambition, Agar Es word ko ulta (Reverse) karna hoga to pahle Ese Stack me Insert karenge phir agar Es stack me data ko pop(Delete)karenge to ye word (String) melega noitibmA

    Esprakar kisi string/word ko reverse kiya ja sakta hai

  2. Undo/Redo:-

    Kisi text editor me, kisi data me kiye gaye changes ko again return karne undo ka use karke step by step us purane text par ja sakte hai. aur Redo ka use karke puna edit ya change kiye huye text par pahuch sakte hai. Eska use excel ya word me kiya jata hai

  3. Tower of Hanoi:-

No comments

Theme images by 5ugarless. Powered by Blogger.