Академический Документы
Профессиональный Документы
Культура Документы
BASIC OPERATION
Traverse
Insertion
Deletion
Search
Update
Insertion Operation
Insert one or more elements
eg.
LA-linear array
N elements
K- positive integer , k<=N
Alg;
1.Start
2.Set J=N
3.Set N=N+1
4.Repeat step 5 and 6 while J>=K
5.Set LA[ J+1]=LA[ J ]
6.Set J=J+1
7.Set LA[k]=ITEM
8.Stop
Deletion Operation
removing and reorganizing
element of an array
ALG
LA-linear array with N elements, K<=N
1.Start
2.Set J=K
3.Repeat step 4 and 5 while J<N
4.Set LA[ J-1]=LA[ J ]
5.Set J=J+1
6.Set N=N+1
7.Stop
Update Operation
updating an existing element of
array at
a given index.
Alg;
LA-Linear array, N-element,
K- Positive integer
1.Start
2.Set LA[K-1]=item
3.Stop
Searching Operation
searching based on index or value
LA-Linear array, N-element,
K- Positive integer
Alg;
1.Start
2.SET J=0
3.Repeat step 4 and 5 while J<N
4.If LA[ J] is equals item then goto step 6
5.Set J=J+1
6.Print J, Item
7.Stop
STRING
String in an one dimenstional array of
characters terminated by a Null
character
Eg . Char
greetings{6}={h,e,l,l,o,\o}
Null character represents the end of
an
string-\o
SOME FUNCTION
Strcpy(S1,S2)
Strcat(S1,S2)
Strlen(S1)
Strcmp(S1,S2)
Strchr(S1,ch)
Strstr(S1,S2)