Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write pseudo code to do the following. Your pseudo code or algorithm must follow

ID: 3903296 • Letter: W

Question

Write pseudo code to do the following. Your pseudo code or algorithm must follow all the rules of an algorithm. It must be written in steps. No paragraphs. All conditions and iterations must be clearly specified. You must use loops and functions to do this. The steps in the pseudo code must be very clear without ambiguity. Please submit a separate txt file for this part.
1. To remove numbers from an array given the array and the position of the number to remove. You should not replace the element with 0. If your original array was {34, 12, 56, 18, 20, 16, 8, 9, 10, 11}, after removing the element from position 0, your array should print {12, 56, 18, 20, 16, 8, 9, 10 11}.
2. To insert numbers from an array given the array, the number to insert, and the position where the number should be inserted. If your original array was {34, 12, 56, 18, 9, 10, 11}, after inserting the number 15 at position 1, your array should print {15, 34, 12, 56, 18, 9, 10 11}. You should make sure that size does not exceed capacity when inserting.

Explanation / Answer

pseudo code:-

1.

let the pseudo code be known as remove(int a[n], int k)

where a[n] is the array in which element needs to be removed from kth index.

remove(int a[n],int k)

{

if(k>=n)// if this happen then there is no such index in array a

exit(1);//exit with error code 1

else

{

for(i = k; i<n; i++)

{

a[i] = a[i+1];// shift each number to left

}

n=i-1;// set the last index of array to i-1

printf(a);

}

}

2).let the pseudo code be known as insert(int a[n],int p,int k),where k is the index at which number p needs to be inserted.

insert(int a[n],int p,int k)

{

if(k>=(n+1))// if that position leaves a vacant place in array.

{

exit(1);//exit with error code 1

}

else

{

for(i=k; i<=n; i++)

{

a[i+1] = a[i];// shift each element to the right

}

a[k] = p;

n = i+1;

print(a);

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote