Please I need just the pseudocodes for the following quation

Please I need just the pseudocodes for the following quations.

1) Design a program in pseudocode that has an array of 25 integers (one of the values must be 75). Include a module that sorts the array content (use any sort algorithm except sequential). The program then is to call a module that uses the binary search algorithm to find the value 75.

2 Design a program in pseudocode that allows a user to enter 20 names into a String array, then sort the array in ascending order (alphabetical order). You may use any sort algorithm. Finally, the program is to display the sorted contents of the array in sorted order.

Solution

1) int a[25]={1,2,3,4,5,6,7,8,9,..24,75}

a=selection(a);

binarysearch(a,75,0,24);

int selection(a){

for i from 0 to 23

min=a[i]

for j from 1 to 24

if min>a[j]

min=a[j]

loc=j

temp=a[i]

a[i]=a[loc]

a[loc]=temp

}

binarysearch(int a[], int s, int low, int high){

mid=low+high/2;

if(a[mid]==s)

print found at mid

else if s>a[mid]

binarysearch(a,s,mid+1,high)

else

binarysearch(a,s,low,mid-1)

}

2) string s[20]={\"qw\", ....}

s=selection(s) // selection is showed in problem 1

display s

Please I need just the pseudocodes for the following quations. 1) Design a program in pseudocode that has an array of 25 integers (one of the values must be 75)

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site