Professional Documents
Culture Documents
A289676274 23532 22 2020 Array
A289676274 23532 22 2020 Array
1. Start
2. Set J = K
3. Repeat steps 4 and 5 while J < N
4. Set LA[J] = LA[J + 1]
5. Set J = J+1
6. Set N = N-1
7. Stop
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int a[10]={2,3,4,5,6};
int n,item;
int j=6,i,k;
cin>>k;
item=a[k];
if(k<=n)
{
j=n;
for(j=k;j<n-1;j++)
{
a[j]=a[j+1];
}
n=6;
cout<<endl<<"New Array"<<endl;
for(i=0;i<n;i++)
{
cout<<a[i]<<endl;
}
}
Linear Search
Linear Search (Array A, Lower Bound, Value x) :
1. Set i =Lower Bound
2. if i > n then go to step 7
3. if A[i] = x then go to step 6
4. Set i = i + 1
5. Go to Step 2
6. Print Element x Found at index i and go to
step 8
7. Print element not found
8. Exit
#include<iostream>
using namespace std;
#include<conio.h>
int main()
{
LOC(AUTO[1965])=Base(AUTO)+w(k-
lowerbound)
o =200+4(1965-1932)
o 332