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

I can\'t for the life of me figure out these algorithms! I need this done in PSE

ID: 3566061 • Letter: I

Question

I can't for the life of me figure out these algorithms! I need this done in PSEUDO-CODE. Not Java. Not C. Not C++. It needs to be old fashioned, by the book, rules based pseudo-code. Full points to shortest and best pseudocode.

Describe an algorithm that takes as input a list of n integers and produces as output the largest difference obtained by subtracting an integer in the list from the one following it. Describe an algorithm that takes as input a list of n integers in nondecreasing order and produces the list of all values that occur more than once. Describe an algorithm that takes as input a list of n integers and finds the total number of negative integers in the list. A palindrome is a string that reads the same forward and backward. Describe an algorithm that determines whether a string of n characters is a palindrome.

Explanation / Answer

Algorithm 1:-

Let n=total numbers in the list
Let int list[]=new int[n]
Let difference=0;
for(i=0 to length(list)-1)
   {
   if(i is equal to 0)
       difference =list[i] - list[i+1]

   if(list[i]-list[i+1] is greater than difference)
       difference = list[i] - list[i+1]

   }
display difference

Algorithm 2:-

Let n=total numbers in the list
Let int list[]=new int[n]
Let output_list=null;
for(i=0 to length(list))
   {
   for(j=i+1 to length(list))
       {
       if(list[i] is equal to list[j])
           add list[i] to output_list
       }
   }
for(i=0 to length(output_list))
   display output_list[i]

Algorithm 3:-

Let n=total numbers in the list
Let int list[]=new int[n]
Let total=0;
for(i=0 to length(list))
   {
   if(list[i] is less than 0)
   increment total by 1
   }
display total

Algorithm 4:-

Let input_string=string with 'n' characters
Let check_string=NULL
for(i=0 to length(input_string))
   {
   char p = obtain the character at position i from the given input_string
   check_string = p concat check_string
   }
if(check_string equals(Ignoring Case) input_string)
   display "The string is palindrome"
else
   display "The string is not palindrome"
  

      

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