Array in Data Structure in Hindi
A linear array is a list of find numbers of (N) of the homogeneous data elements. array मे element index के द्वारा represent किए जाते है ।
array के element successive memory location पे स्टोर रहते है
array की length या size UB-LB+1 होती है
जब हमें किसी Program में एक ही प्रकार के बहुत सारे Data को Store करके Access व Manipulate करना होता है, तब हम इन समान प्रकार के Data को Store करने के लिए बहुत सारे Variables Declare करने के स्थान पर Array Declare करते हैं।
Syntax:
अब एक ऐरे का उपयोग करने के लिए syntax देखते हैं:
Array Declaration: Datatype array_name [size]
Array Initialization: Datatype array_name [size] = {value1, value2…Value n};
Example:
Int A [5];
Int A [3] = {100, 1000, 10000};
Where Int – is the data type of Integer
A [5] – Array A of size 5
A [3] – Array A of size 3
Types of Array in Data Structure in Hindi
डाटा स्ट्रक्चर मे अरराय दो प्रकार के होते है
-
One-dimensional array
-
Two-dimensional array (Multi-dimensional array)
initializing One-dimensional array
array को declare करने के लिए array का size program बनाते time पर ही बताना पड़ता है । array का size ruining time पर घटा या बड़ा नहीं सकते है । array को इस प्रकार से declare या initialize कर सकते है
int LA[10];= (1,2,3,4,5,6,7,8,9,10)
char LA[];= {‘h’,’e’ ,’E’ , ‘d’, ‘I’}
one dimensional के elements मे Access करना
Array Name[index];
इस syntax से हम array के element मे access कर सकते है ।
array मे किसी element को location देने के लिए
LA[1]=9; (second location)
array मे किसी element की value को डालने का formula
scanf(%d,&LA[3]);
Two-dimensional array (Multi-dimensional array)
two-dimensional array मे N row तथा M column होते है
LA[M][N]
इसे M*N array भी कहते है इस array मे index integer के एक pair (J, K) रूप मे होते है index को subscript भी कहते है ।
Initialization Two-dimensional array
int LA[3][3]= {2,3,4,5,6,7,8,9,10}
access in array =a[1][1]=10
a[2][1]=40;
Tow Dimensinal Array को Implimantation दो प्रकार के होते है
(1) Row Major Implementation
(2) Column Major Implementation
Row Major Implementation
इस Implementation मे array computer से row size पड़ा जाता है सबसे पहले first-row store होती है फिर second-row store होती है।
Column Major Implementation
इस Implementation मे array computer से column size पड़ा जाता है सबसे पहले first column store होती है फिर second column स्टोर होती है
यह पोस्ट आपको केसी लगी । क्र्पया comment कर के बताये । अपनी राय देने के लिये commentकर सकते है
[wpforms id=”197″ title=”true”]