Question

Write a pseudo code of an algorithm that returns "yes" if the input array (contains integers)...

Write a pseudo code of an algorithm that returns "yes" if the input array (contains integers) is a palindrome, and no if it is not (means first item is the same as last one, second one is the same as second from the last & ...)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Pseudocode

   CheckArrayPalindrome(A, n)
       START
           DECLARE Flag = false
           DECLARE i = 0

           WHILE (i <= n/2 and n != 2)
               IF (A[i] != A[n - i - 1])
                   Flag = true;
                   break;
               i += 1;

           IF Flag == 1
               PRINT "NO"
           Else
               PRINT "YES"
       END

Add a comment
Know the answer?
Add Answer to:
Write a pseudo code of an algorithm that returns "yes" if the input array (contains integers)...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT