1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Maksim231197 [3]
2 years ago
15

palindrome is a string that reads the same forwards as backwards. Using only a xed number of stacks, and a xed number of int and

char variables, write an algorithm to determine if a string is a palindrome. Assume that the string is read from standard input one character at a time. The algorithm should output true or false as appropriate
Computers and Technology
1 answer:
bixtya [17]2 years ago
6 0

Solution :

check_palindrome$(string)$

   lower_$case$_string$=$ string$. to$_lower()

   Let stack = new Stack()

   Let queue = new Queue();

   for each character c in lower_case_string:

       stack.push(c);

       queue.enqueue(c);

   let isPalindrome = true;

   while queue is not empty {

       if (queue.remove().equals(stack.pop())) {

           continue;

       } else {

           isPalindrome=false;

           break while loop;

       }

   }

   return isPalindrome

Input = aabb

output = true

input =abcd

output = false

You might be interested in
A spreadsheet has some values entered: Cell A1 contains 10, cell A2 contains 14, cell A3 contains 7. You enter in cell A4 the fo
lesya [120]
The value displayed in A4 is 24
5 0
3 years ago
Choose the 3 Points in good story telling
Sidana [21]

Answer:

1.Choose a clear central message 2. Embrace conflict 3.Have a clear structure  

Explanation:

8 0
2 years ago
What statement would you use to print the phrase Hello, world and then start a new line?
tangare [24]

Answer:

Statement to print phrase "Hello, world" and then start a new line in java.

System.out.println("Hello, world");

Explanation:

In java, we use "System.out.println();" statement to print any string/phrase and then start a new line.The above line will print phrase "Hello, world" and then start a new line.

Implementation in java:

// class definition

class Main

{

// main method of the class

public static void main (String[] args)

{

// statement to print phrase and start new line

      System.out.println("Hello, world");  

} }

7 0
3 years ago
How to connect to the internet through another computer?
Yuri [45]
You go to settings , go to wifi, click on your wifi server, type in password, and your in! or if you mean like going on google, you just click an icon named google, Yahoo, msn, ect...
6 0
3 years ago
How many times can a simulation be repeated?
Vinvika [58]

Answer:

Explanation:

A general idea is that you should repeat the simulation until the results converge. An easy but illustrative example of this is that we want to see if the R function rbinom is accurate in simulating a coin toss with a given probability. We will simulate one coin toss 10000 times, and plot the percentage of heads against the number of coin tosses:

set.seed(1)

n <- 10000

result <- NULL

percent <- NULL

for (i in 1:n) {

 result[i] <- rbinom(1,1,0.5)

 percent[i] <- sum(result)/i

}

plot(seq(1:10000),percent, type="l")

abline(0.5, 0, lty=2)

5 0
3 years ago
Other questions:
  • A patent facilitates a government-approved technological monopoly by
    5·1 answer
  • Add is a function that accepts two int parameters and returns their sum.
    8·1 answer
  • Which of the following is the best example of market censorship
    11·2 answers
  • "running computer programs and their data are stored in ___"
    10·2 answers
  • You're the network administrator for a company that has just expanded from one floor to two floors of a large building, and the
    7·1 answer
  • A _____ miniature battery operated transmitter that can be propelled through a non-metallic pipe or purpose of locating
    6·1 answer
  • Please Help Me!!!!!!!!!!!!!
    5·1 answer
  • Your location has been assigned the 172.149.254.0 /24 network. You are tasked with dividing the network into 13 subnets with the
    12·1 answer
  • Who invented computer ?​
    9·2 answers
  • 12. Your project specifications call for a business rule that the database design can't
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!