Advertisement

Queue Data Structure क्या है? और यह कितने प्रकार के होते है?

Queue एक बहुत ही ज्यादा महत्वपूर्ण data structure है, जो हमेशा FIFO (First In, First Out) के सिद्धांत पर काम करता है। इसमें डेटा जो होता है वह उन्हीं क्रम (sequence) में प्रोसेस होता है, जिस order में वह संग्रहित (insert) किया गया होता है। Queue data structure जो है वह कंप्यूटर साइंस के कई सारे अलग - अलग यानि विभिन्न प्रकार के applications जैसे printer spooling, process scheduling, और network के data packet management में काफी हद तक उपयोग होती है। तो आज के इस blog पोस्ट में हम Queue डेटा संरचना को विस्तार से समझने वाले है जैसे Queue data structure क्या होता है, इसके प्रकार कौन - कौन से होते है, इसमें कौन - कौन से operations को perform किया जाता है, साथ ही इनके अलावा हम यह भी जानेगे की आज के समय में इसका उपयोग किन - किन जगहों पर किया जा रहा है। अगर आप भी इन सभी टॉपिक्स से सम्बंधित जानकारी प्राप्त करना चाहते है तो इस post को पूरा जरूर पड़े। तो चलिए शुरू करते है और जानते है।

What is Queue Data Structure in Hindi - Queue डाटा स्ट्रक्चर क्या है?

Queue Data Structure जो है वह एक तरह का linear और non-primitive डाटा स्ट्रक्चर है, और यह एक इस प्रकार का Data Structure जो विल्कुल real-world queue की तरह काम करता है। यानि queue जो होता है वह हमेशा FIFO (First-In-First-Out) के सिद्धांत पर काम करता है, इस सिद्धांत में यह होता है की जो भी item सबसे पहले add हो रहा है उसी item को सबसे पहले remove किया जाए, और जिस item सबसे बाद में add किया जा रहा है उसे सबसे बाद में ही remove किया जाए। Queue एक ऐसी लिस्ट है जिसमे दो end point होते है जिन्हे हम "rear end/tail" और "front end/head" के नाम से जानते है। [caption id="attachment_2269" align="alignright" width="300"]Queue Data Structure Queue Data Structure[/caption] इसमें जो rear end होता है उसकी सहायता से उन elements को add किया जाता है जो सबसे लास्ट में आया है यानि जो नए elements है, और front end का उपयोग उन सभी elements को निकलने (Remove) के लिए किया जाता है जिन्हे सबसे पहले add किया गया था यानि जो elements पुराने हो गए है। दूसरे शब्दों में कहे तो, Queue जो है वह एक abstract data structure है जो एक लाइन की तरह होता है, यानि इसमें सभी elements एक ही order में स्टोर (store) होते है। यह ज्यादा तर Stack की तरह ही होता है, लेकिन Stack मे सिर्फ एक ही end (top) होता है जिसकी सहायता से ही insertion और deletion जैसे operation किए जाते है, जबकि Queue जो है उसमे दोनों ends खुले (open) होते है। अगर Queue Data Structure को efficiently implement करना है तो उसके लिए array या फिर linked list का उपयोग करना होगा। जिसके उपयोग CPU scheduling, printer management, और call handling systems आदि जैसे applications में किया जाता है। Queue Real-world example: Queue का एक simple और real-world example बैंक और ticket counter की लाइन है, जिसमे जो भी व्यक्ति सबसे पहले आता है, उस का number सबसे पहले आता है, और जो भी नए लोग होते है वह हमेशा line के पीछे लगते रहते है (rear end), और जो सबसे आगे होता है, वह सबसे पहले बहार चला जाता है (front end).

Basic Terminologies of Queue in Hindi

  • Front: यह Queue का वो position होता है जँहा से उन elements को remove किया जाता है जो पहले add किए गए थे, और ये element वो होता है जो सबसे पहले queue में आया था और सबसे पहले ही process होता है।
  • Capacity: capacity उसे कहाँ जाता है जिसमे यह बताया जाता है की Queue में जो elements store हो रहे है वह maximum कितने number तक हो सकते है, अगर किसी कारण से queue अपनी capacity से पूरी तरह बहार हो जाता है तो बाद में ओर elements को जोड़ा (add) नहीं जा सकता है।
  • Size: Queue में जितने भी elements के current number होते है उनको ही size कहा जाता है। यानि इस में यह बताया जाता है अभी इस वक्त queue में कितने elements उपस्थित है।
  • Rear: यह Queue का वो position होता है जंहा से आने वाले नए elements को जोड़ा (add) जाता है। सरल भाषा में कहे तो यह वो end होता है जंहा से आने वाले सभी नए item को insert किया जाता है, जिसे हम queue का last element भी कहते है।

Features of Queue in Hindi

इसकी कई सारी विशेषताएं होती हैं जिनमे से कुछ विशेषताओं को हमने नीचे परिभाषित किया है:
  1. Queue Data Structure हमेशा FIFO (First-In-First-Out) के सिद्धांत (rule) को follow करती है, यानि जो पहले आता है, वही सबसे पहले जाता है।
  2. Queue Data Structure के दो ends होते है जिनमे से जो Front End होता है उससे elements remove होते है और जो Rear End होता है उससे आने वाले नए elements add होते है।
  3. क्योकि Queue Data Structure एक linear data structure है जिसके कारण इसमें जो elements होते है वह हमेशा एक order में store होते है।
  4. अगर हमें Queue Data Structure में किसी नए element remove करना है तो उसके लिए हमें इससे पहले add किए गए सभी elements को remove करना होगा, उसके बाद ही हम उस नए element को remove कर सकते है।
  5. यह multi-processing और multi-tasking में काफी मदत करता है।
  6. इसमें हमेशा elements एक order एक्सेस होते है, यानि यह कभी भी random access को allow नहीं करता है।

Operations of Queue in Hindi

Queue Data Structure में निम्नलिखित operations को perform किए जाते हैं:
  • Enqueue: जब भी हमें Queue में किसी नए item या element को add या insert करना होता है तो उस समय Enqueue Operation work करता है। अगर कभी queue full हो जाता है, तो उसके बाद इसमें नए elements insert नहीं हो सकते।
  • Dequeue: जब भी Queue Data Structure में किसी item/element को हटाना (remove) होता है उस समय Dequeue Operation काम करता है।
  • Peek (Front): Queue में बिना किसी item या element को हटाए अगर front element को प्राप्त करना हो तो उसके लिए इस Peek Operation का उपयोग किया जाता है। साथ ही यह ये भी बताता है की next remove होने वाला element कौन सा है।
  • isEmpty: Queue Data Structure के अंदर यह Check करना की यह खाली या फिर भरा हुआ, इसके लिए isEmpty Operation काम करता है। अगर queue empty होता है, उस समय उसको underflow condition कहा जाता है।
  • isFull: अगर Queue overflow हो रहा है तो हमें उसके बाद यह Check करना होता है की queue पूरी तरह भरा भी है या नहीं। क्योकि हमेशा queue तभी overflow condition में होता है जब पूरी तरह भर जाता है।

Applications of Queue in Hindi

Queue का उपयोग नीचे दी हुई निम्नलिखित जगहों पर किया जाता है:
  • CPU & Disk Scheduling: Queue Data Structure का उपयोग CPU और disk scheduling के लिए काफी ज्यादा होता है, जिसमे होने वाली processes हमेशा FIFO के order में execute होती है।
  • Call Center Systems: जब Call center phone systems में कस्टमर्स calls को एक ऑर्डर में hold किया जाता है तो उस समय Queue Data Structure का उपयोग किया जाता है।
  • Buffer Management: Queue Data Structure जो है वह MP3 player, CD player और media streaming आदि जैसे applications में हमेशा एक buffer की तरह काम करता है।
  • Media Player Playlist: किसी भी तरह के Media Player में Songs को एक order में add और remove करने के लिए भी queue का ही उपयोग किया जाता है।
  • Printing Queue: जब भी एक साथ Multiple print requests आती है तो वे सब भी queue में ही store होती है जिसके के बाद जो भी request पहले आई है वह सबसे पहले process होती है।
  • Online Ticket Booking: Railway, movies और events आदि के ticket booking system में जीतनी भी requests प्राप्त होती वह सभी queue में store होती है और फिर उसके बाद वह FIFO order में process होती है।
  • Traffic Management: Traffic signals पर भी vehicles हमेशा queue में रुकते है और फिर उसके बाद FIFO order में move करते है।
  • Messaging Systems: Chat applications और email servers में जितने भी messages होते है वह सभी queue में store होते है फिर उसके बाद एक proper sequence में deliver किए जाते है।

Types of Queues in Hindi - Queue के प्रकार

Queue डाटा स्ट्रक्चर चार प्रकार के होते है जिनको हमने नीचे डिफाइन किया है:
  1. Linear Queue
  2. Double-Ended Queue (Deque)
  3. Circular Queue
  4. Priority Queue
[caption id="attachment_2077" align="aligncenter" width="450"]Types of Queue Data Structure Types of Queue Data Structure[/caption]

1. Linear Queue

ये जो Queue है वह हमेशा FIFO structure को follow करता है। इसमें हम items या elements को सिर्फ rear end की सहायता से ही add कर सकते है और front end की सहायता से element को remove कर सकते है। यानि, जो सबसे पहले आता है, वही सबसे पहले remove होता है। [caption id="attachment_2078" align="aligncenter" width="350"]Simple or Linear Queue Data Structure Simple or Linear Queue Data Structure[/caption] इसमें दो मुख्य operations होते है: एक insert (rear se) और दूसरा remove (front se). Linear Queue का उपयोग सभी tasks को एक order में process करने के लिए किया जाता है।

2. Double-Ended Queue (Deque)

Double-Ended Queue, को हम Deque के नाम से भी जानते है, यह एक ऐसी queue होती है जिसमे insertion और deletion दोनों operations को हम दूसरे ends से भी कर सकते है। यानि, इसमें हम किसी भी elements को दोनों ends के जरिए add या remove कर सकते है। Deque जो है वह दो प्रकार (types) की होती है: [caption id="attachment_2079" align="aligncenter" width="350"]Double-Ended Queue Double-Ended Queue[/caption] Input Restricted Queue: इस तरह के जो queue होते है उनमें हम input को सिर्फ एक ही end से ले सकते है, लेकिन अगर किसी element को deletion करना हो तो हम उसे दोनों ends से कर सकते है। यानि, इसमें insert सिर्फ एक end से होता है लेकिन remove दोनों ends में से किसी से भी हो सकता है। [caption id="attachment_2080" align="aligncenter" width="350"]Input Restricted Queue Input Restricted Queue[/caption] Output Restricted Queue: Deque के इस प्रकार में किसी भी element का input दोनों ends में से किसी भी end की सहायता से लिया जा सकता है, लेकिन अगर किसी element को deletion करना हो तो उसको हम सिर्फ एक end से ही कर सकते है। यानि, इसमें insert तो दोनों ends से हो सकता है लेकिन remove एक ही end से होता है। [caption id="attachment_2081" align="aligncenter" width="350"]Output Restricted Double-Ended Queue Output Restricted Double-Ended Queue[/caption]

3. Circular Queue

Circular Queue एक बहुत special queue होता है जिसमे special फीचर यह है की इसका जो लास्ट position होती है उसको first position से जोड़ दिया जाता है। इसका मतलब यह होता है की जब भी queue Data Structure पूरी तरह से भर जाता है, तो पुरानी spaces को हम दुबारा से use कर सकते है। यह भी हमेशा FIFO order को ही follow करता है। इसका उपयोग ज्यादा तर memory का अच्छी तरह से उपयोग और tasks को बेहतरीन यानि efficiently handle करने के लिए किया जाता है। [caption id="attachment_2082" align="aligncenter" width="350"]Circular Queue Data Structure Circular Queue Data Structure[/caption]

4. Priority Queue

Priority Queue एक इस तरह का special queue होता है जिसमे elements जो होते वह उनकी priority के हिसाब से arrange होते है। यह दो प्रकार के होते है: [caption id="attachment_2083" align="aligncenter" width="350"]Priority Queue Data Structure Priority Queue Data Structure[/caption]
  • Ascending Priority Queue: यह Queue Data Structure जो होता है उसमे जितने भी elements होते है वह priority के increasing order में उपस्थित होते है, यानि इसमें जो element सबसे काम priority वाला होगा वह सबसे पहले remove होता है।
  • Descending Priority Queue: इस Queue में जितने भी elements होते है वह सभी priority के decreasing order में होते है, मतलब जो element सबसे ज्यादा priority वाला होता है वह element सबसे पहले remove होता है।
Priority Queue का उपयोग हमेशा महत्वपूर्ण (important) tasks को सबसे पहले process करने के लिए किया जाता है, जैसे job scheduling, emergency services, या फिर network data transmission आदि।

निष्कर्ष (Conclusion)

आज हमने इस पोस्ट की सहायता से यह जाना की Queue Data Structure क्या होता है, यह कैसे काम करता है, यह कौन - कौन से operations को perform करता है, साथ ही हमने यह भी जाना की इसके प्रकार कौन - कौन से होते है। उम्मीद है की आपको यह जानकारी पसंद आई होगी और इसकी साझयता से आपको कुछ नया सीखने को मिला होगा। फिर भी अगर आपको इस टॉपिक से सम्बंधित कोई डाउट या किसी तरह का सुझाब देना हो तो आप हमें कमेंट के जरिए बता सकते है। ऐसे ही और भी interesting topics से सम्बंधित जानकारी के लिए जुड़े रहे “The Hindi Study” के साथ। Thank You!

Table of Contents

Close

Comments

Share to other apps

Report Content

Why are you reporting this content?

Your selection helps us review the content and take appropriate action.

Hate & Discrimination
Content that spreads hate or unfair treatment against a person or group because of who they are.
Abuse & Harassment
Content that insults, threatens, bullies, or makes someone uncomfortable.
Violence & Threats
Content that talks about hurting people, animals, or property, or supports violence.
Child Safety
Any content that harms, exploits, or puts children at risk.
Privacy Violation
Sharing someone’s personal information or photos without permission.
Illegal & Regulated Activities
Content that promotes or helps with illegal activities like drugs, weapons, or trafficking.
Spam & Misleading Content
Fake, misleading, or repeated content meant to trick users.
Suicide or Self-Harm
Content that encourages or explains self-harm or suicide.
Sensitive or Disturbing Content
Shocking or graphic content that may upset users.
Impersonation
Pretending to be another person or organization.
Extremism & Hate Groups
Content that supports violent groups or hateful ideas.
Civic Integrity
Content that spreads false information about elections or public processes.