I need to solve these questions as a simple english (algorithms) Question 3 You
ID: 667902 • Letter: I
Question
I need to solve these questions as a simple english (algorithms)
Question 3 You are given a word, and need to decide if it is a palindrome or not. What steps do you take? Question 4 You have a stack of one thousand notecards, and each notecard has a number on it. You need to find the card with the highest number on it. What steps do you take? (Hint: Look through the cards and find the highest number. is not a solution. How do you determine which of two numbers s higher? How do you keep track of(i.e., store?) the highest number you?ve found so far?) Question 5 You are given a number and need to compute its factorial. What steps do you take?Explanation / Answer
3)
you can check for palindrome by reversing the string and after reversing checking that both the strings are equal or not.
4)
while pushing in the stack keep the maximum in the top.
this way it will be done in O(1)
5)
to compute factorial you need to multiply the number from 1 to n to get n!
something like
for (i=1;i<n+1;i++)
{
temp=1*i;
}