Advertisement

Array in Data Structure in Hindi | ऐरे क्या है, प्रकार और उपयोग

इस ब्लॉग पोस्ट में, हम array से सम्बंधित कुछ कुछ चर्चा करने वाले है जैसे Array क्या होता है, इसकी विशेषताएं कौन - कौन सी है, और इसके टाइप्स कौन - कौन से है। इनके अलाबा ऐरे के कुछ और भी टॉपिक है जिनके वारे में हम इस पोस्ट में चर्चा करने वाले है। तो चलिए शुरू करते है।

What is Array in Data Structure in Hindi - डेटा संरचना में ऐरे क्या है?

Array एक non-primitive linear data structure है जो एक जैसे data type के elements को एक साथ यानि continuous मेमोरी ब्लॉक में store करता है। Array के elements को उनके position (index) के ज़रीए competence access किया जा सकता है।

Array जो है वह एक apartment building के फ्लोर्स की तरह होता है। जिसमे हर एक फ्लोर का एक नंबर दिया होता है, और इसका हर एक नंबर एक डाटा (resident) को परिभाषित करता है। इसमें जो Floors होते है वह एक के ऊपर एक यानि sequential order में stacked होते है। अगर आपको किसी फ्लोर का नंबर पता है, तो आप बिना किसी तरह की confusion के आसानी से पता लगा सकते है की कौन सा डाटा कंहा पर उपस्थित है।

Advertisement

दूसरे शब्दों में देखा जाए तो ऐरे एक fixed और sequential structure होते है, जिसमे आप अपने डाटा को उसके index के आधार पर आशानि से locate कर सकते है। इसमें सबसे पहले एलिमेंट का memory address (Base value) और पोसिशन्स के अंतर (offset) का उपयोग करके किसी भी एलिमेंट की memory location को efficiently कैलक्युलेट किया जा सकता है।

Key Features of Array in Hindi - ऐरे की मुख्य विशेषताएं।

Fixed Size:

अगर एक बार कोई ऐरे (array) create हो जाता है तो उसके बाद उसका size change नहीं किया जा सकता है। इसलिए जब भी आप ऐरे बनाए तो उस समय आपको ऐरे का साइज डिफाइन करना बहुत जरूरी होता है।

Same Data Type:

ऐरे जो होता है उसमे जितने भी elements stored होते है वह सभी एक ही डाटा टाइप के होते है। उदाहरण: Integers, floats, characters, आदि।

Advertisement

Continuous Memory Allocation:

ऐरे के जो elements होते है वह memory में एक continuous block में स्टोर होते है, जो इसकी एक्सेस स्पीड को बढ़ाकर फ़ास्ट बनता है।

Indexing:

ऐरे के हर एक element का अपना एक यूनिक index होता है जो 0 से शुरू होकर इनफिनिट (∞) तक जाता है।

Example:

अगर एक ऐरे [10, 20, 30, 40] है तो :

  • 10 का यूनिक index 0 होगा,
  • और 20 का यूनिक index 1 होगा, और इसी तरह आगे के एलिमेंट्स का यूनिक index होता है।

Types of Arrays in Hindi - ऐरे के प्रकार।

ऐरे मुख्यता तीन प्रकार के होते है :

  1. one-dimensional array.
  2. two-dimensional arrays.
  3. Multi-dimensional arrays.

1. 1-D (One dimensional) arrays:

One-dimensional ऐरे जो है वह सबसे basic और simple ऐरे type है जिसमें सिर्फ एक ही row दी हुई होती है। इस array में elements जो होते है वह एक sequence रूप में स्टोर होते हैं, और इसके हर एक element को उसके index की सहायता से एक्सेस किया जा सकता है। इन arrays का उपयोग तब किया जाता है जब data linear हो। उदाहरण: किसी student के marks या फिर daily temperature readings.

One-dimensional Array

2. 2-D (Two dimensional) arrays:

Two-dimensional array एक तरह से matrix का representation होता है जिसमे rows और columns दोनों दिए होते है। इसमें हर एक एलिमेंट को row और column index की सहायता से एक्सेस किया जाता है। यह ऐरे उस वक्त बहुत उपयोगी होता है जब data tabular form में दिया होता है, उदहारण के लिए जैसे किसी chessboard या excel sheet को प्रदर्षित (represent) करना।

Two-Dimensional array

3. Multi-Dimensional (M-D) Array:

Multi-dimensional array उस समय उपयोग की जाती है तब एक से ज्यादा dimensions का डाटा स्टोर करना हो। उदाहरण के लिए जैसे किसी 3D game के coordinates या एक Rubik's cube की positioning.

Multi-Dimensional Array in Hindi

Operations on Arrays in Hindi

  1. Traversal
  2. Insertion
  3. Deletion
  4. Searching
  5. Sorting
  6. Merging
  7. Reversing

1. Traversal

Traversal का यह मतलब है कि ऐरे के हर एक element को एक - एक करके यानि sequentially access करना। ये ऑपरेशन काफी कॉमन है और यह किसी भी ऐरे के सारे एलिमेंट्स पर ऑपरेशन्स परफॉर्म करने के लिए इस्तेमाल होता है।

2. Insertion

Insertion ऐरे की सहायता से किसी specific position पर एक नया element add किया जा सकता है। लेकिन जो Fixed-size ऐरे होते है उनमें, नए element के लिए जगह बनाने के लिए एलिमेंट्स को shift करना पड़ता है, जिसमे समय की खपत हो सकता है। Dynamic ऐरे इस process को simple करते हैं।

3. Deletion

Deletion का मतलब है ऐरे के किसी element को remove करना। फिर इसके बाद बाकी के एलिमेंट्स को शिफ्ट करना पड़ता है ताकि उन्हें continuity maintain रखा जा सके। यह ऑपरेशन भी समय की खपत करने वाले हो सकता है।

4. Searching

Searching का मतलब यह चैक करना है, कि यह जो ऐरे है उसमें specific element उपस्थित है या नहीं, और इन ऑपरेशन को दो तरीकों से किया जा सकता है:

  1. Linear Search: Sequentially यानि एक - एक करके हर एक element को चैक करना।
  2. Binary Search: यह सिर्फ sorted arrays के लिए उपयोग होता है, और divide-and-conquer approach को follow करता है।

    5. Sorting

    Sorting का यह मतलब है की ऐरे के अंदर जो elements है उनको ascending या descending order में arrange करना। यह ऑपरेशन किसी भी डाटासेट को organize और efficient बनाने के लिए बहुत जरूरी है:

    1. Bubble Sort: Adjacent एलिमेंट्स को compare और स्वैप करता है।
    2. Quick Sort: यह Divide-and-conquer मेथड का उपयोग का उपयोग करता है, एक pivot एलिमेंट का around partitioning करता है।
    3. Merge Sort: यह sorted sub-arrays को बनाते हुए, ऐरे को repeatedly डिवाइड और मर्ज करता है।

    6. Merging

    Merging का मतलब यह है की दो या उससे अधिक sorted arrays को मिलकर एक नया sorted ऐरे बनाना। इसके अलाबा इसका मुख्य purpose यह है, कि डाटा को efficiently organize करना, और इसमें जितने भी ऐरे मिलाए गए है उनके elements का ऑर्डर हमेशा मैंटेन रहे। यह जो operation है वह अक्सर divide-and-conquer algorithms, जैसे merge sort, आदि में उपयोग होता है।

    7. Reversing

    Reversing ऐरे का यह मतलब है की elements को उल्टा करना, फिर उसके बाद उसमे जो पहला एलिमेंट होता है वह लास्ट पोजीशन पर और जो लास्ट एलिमेंट होता है वह फर्स्ट position पर पहुंच जाता है।

    Applications of the Array in Hindi

    • ऐरे का उपयोग CPU scheduling algorithms के लिए किया जा सकता है।
    • Sorting algorithms जो है उसको ऐरे data structure का उपयोग करके implement किया जा सकता है।
    • ऐरे का इस्तेमाल matrices से जुड़े हुए काम्प्लेक्स प्रोब्लेम्स को solve करने के लिए होता है।
    • Database में जो records स्टोर किये गए है उनको ऐरे data structure का उपयोग करके arrange किया जाता है।
    • Queue, Stack, HashMap, आदि, जैसे दूसरे डाटा स्ट्रक्चर को भी ऐरे की सहायता से implement किया जाता है।
    • इसमें एक ही नाम उपयोग कई सारे अलग - अलग variables के लिए किया जा सकता है।
    • यह उन सभी elements को भी स्टोर कर सकता है जिनका डाटा टाइप same होता है।

    Indexing in the array in Hindi

    ऐरे में Indexing का मतलब यह होता है की ऐरे के जो एलिमेंट्स होते है उनको access करना या फिर उन्हें identify करने के लिए उनका एक position number उपयोग करना। ऐरे के एलिमेंट्स हमेशा sequential memory locations में स्टोर्ड होते है, और हर एक एलिमेंट का अपना खुद का एक unique index होता है, जो उसकी position को प्रदर्शित करता है।

    Types of Array Indexing in Hindi - ऐरे इंडेक्सिंग के प्रकार

    ऐरे indexing के टाइप्स निम्नलिखित हो सकते है:

    0-based indexing

    अगर किसी ऐरे का जो पहली वैल्यू जो है, वह index `0` पर स्टोर होती है, तो उसको इंडेक्सिंग को 0-based indexing कहा जाता है। ज्यादातर जीतनी भी प्रोग्रामिंग languages जो होती है, जैसे - C, C++, Python, Java आदि यह सभी 0-based indexing का ही पालन करती है।

    Example:

    int arr[5] = {10, 20, 30, 40, 50};

    arr[0] = 10

    1-based indexing

    अगर किसी ऐरे का इंडेक्स (index) `1` से शुरू होता है तो उसको 1-based indexing कहा जाता है। इसका यह मतलब होता है की ऐरे की जो पहली वैल्यू है उसे index-1 assign किया जाएगा।

    Example:

    Array: [10, 20, 30, 40]

    Index: 1 2 3 4

    Index 1 → Value = 10

    Index 3 → Value = 30

    N-based indexing

    ये वो ऐरे होते है, जिनका सबसे पहला index element जो है वह किसी भी value से start हो सकता, फिर चाहे वो negative value ही क्यों न हो, इस तरह के ऐरे को ही N-based indexing कहा जाता हैं।

    इस प्रकार की indexing काफी ज्यादा flexibility प्रदान करती है जैसे कि आप ऐरे के किसी भी एलिमेंट्स का access किसी भी customized index range के माध्यम से कर सकते हैं, जो जीरो या वन पर फिक्स्ड नहीं होती है।

    Example:

    arr = {-2: 10, -1: 20, 0: 30, 1: 40}

    arr[-2] = 10

    arr[0] = 30

    arr[1] = 40

    Difference Between Array and Linked List in Hindi

    Feature Array Linked List

    Memory Allocation

    Continuous non-continuous
    Size Fixed Dynamic
    Access Time O(1) O(n)
    Insertion/Deletion Slow (O(n)) Fast (O(1) at head)
    Cache Friendliness High Low

    Advantages of Array in Data Structure in Hindi - डेटा स्ट्रक्चर में ऐरे के लाभ।

    • Random Access: ऐरे का उपयोग करके elements को index के जरिए direct access किया जा सकता है, जो retrieval को कई ज्यादा fast बनाता है और इसकी time complexity O(1) होती है।
    • Efficient Memory Allocation: ऐरे को लगातार किसी भी मेमोरी locations में स्टोर किया जाता है, जो memory का उपयोग करके optimize करता है और cache performance को भी improve करता है।
    • Ease of Traversal: ऐरे में जो elements होते है वह sequentially यानि एक के बाद एक के रूप में stored होते है, इस कारण से उन्हें traverse करना काफी आसान होता है।
    • Fixed Size Data के लिए Best: जब आपको डाटा का साइज पहले से ही पता होता है, तो ऐरे का उपयोग करना काफी ज्यादा stable और efficient होता है।
    • Sorting और Searching के लिए Useful: ऐरे और बाइनरी सर्च (binary search), जो होते है उनको मर्ज सॉर्ट (merge sort) और quicksort आदि algorithms के साथ आसानी (easily) से उपयोग किया जा सकता है, जो इसको versatile बनता है।

    Disadvantages of Array in Data Structure in Hindi - डेटा स्ट्रक्चर में ऐरे की हनिया।

    Fixed Size:

    अगर एक बार ऐरे का साइज declare कर दिया जाता है तो उसके बाद उसे बदला नहीं जा सकता। इसके अलाबा अगर ऐरे का साइज ज़्यादा बड़ा हो तो मेमोरी बर्बाद (waste) होती है, और अगर कम साइज कम होता है तो memory overflow हो सकता है।

    Insertion और Deletion की Complexity:

    अगर बाद में किसी कारण या जरूरत की वजह से ऐरे के बीच में कोई element insert या delete करना हो, तो सबसे पहले उसके लिए elements उनकी जगह से shift करना पड़ता है, जो O(n) time लेता है।

    Inefficient Memory Usage:

    अगर किसी ऐरे का साइज declared साइज एक्चुअल डाटा से काफी ज्यादा बड़ा हो, तो unused मेमोरी की वजह से efficiency काम हो जाती है।

    Contiguous Memory Requirement:

    ऐरे जो है उसके लिए एक बड़े contiguous मेमोरी ब्लॉक की आवश्यक होती है। यानि अगर किसी कारण से ऐसी memory available नहीं हो पति है, तो allocation problem शुरू हो सकती है।

    Lack of Flexibility:

    ऐरे को dynamically resize करना सम्भब (possible) नहीं होता है, और ये complex relationships को संभालने में भी inefficient होता है। इसी वजह से linked lists या फिर dynamic arrays जो है वह काफी ज्यादा flexible होते है।

    निष्कर्ष (Conclusion)

    अब आप समझ गए होंगे कि Array क्या है, इसकी विशेषताएं, प्रकार और उपयोग क्या हैं। अगर आप DSA सीख रहे हैं, तो Array पहला और सबसे जरूरी टॉपिक है। आप इसे अच्छे से समझकर Sorting, Searching और Advanced Data Structures जैसे Stack, Queue, Linked List को भी आसानी से सीख पाएंगे। अगर आपके मन में Array से जुड़ा कोई सवाल है तो आप नीचे Comment में पूछ सकते हैं।

    FAQs

    Q1: Array क्या होता है?

    Ans: Array एक non-primitive linear data structure है जो एक जैसे data type के elements को continuous memory block में store करता है।

    Q2: Array के कितने प्रकार होते हैं?

    Ans: Array मुख्य रूप से तीन प्रकार के होते हैं – One Dimensional, Two Dimensional और Multi-Dimensional Arrays।

    Q3: Array का सबसे बड़ा फायदा क्या है?

    Ans: Array में elements को उनके index के जरिए O(1) complexity में direct access किया जा सकता है।

    Q4: Array की सबसे बड़ी limitation क्या है?

    Ans: Array का size fix होता है और insertion/deletion operations समय लेने वाले (O(n)) होते हैं।

    Q5: Array और Linked List में क्या फर्क है?

    Ans: Array में continuous memory allocation होता है जबकि Linked List में elements scattered memory में pointers के जरिए store होते हैं।

    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.