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]
3 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]3 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
How many report charts can be added to the account page layout to meet this requirement? A sales manager would like to look at a
Virty [35]

Answer:

D - 2

Explanation:

You can have two report charts per page. You can only add report charts from the enhanced page layout editor.

The mini console and the original page layout editor are not supported. On detail pages, users can refresh up to 100 report charts every 60 minutes. Your organization can refresh up to 3,000 report charts every 60 minutes

8 0
3 years ago
Tikenya was responsible for creating the PowerPoint presentation for the group project. When it was complete, she wanted to emai
Anna35 [415]

Answer:

They had to unzip or extract the zipped/ compressed presentation to see it.                          

Explanation:

  • Compressed file or a zip file contains a large file or more than one files that are packed or enclosed that large file or several files into a file or a folder.
  • The compressed file or folder takes less space than the actual large file or set of files.
  • Just as in this scenario the presentation file was larger than the size of what an email file should be. So Tikenya had to compress the file in order to email it to other members.
  • The other members can open the PowerPoint presentation by following any of the below mentioned methods:
  • In Windows to open a compressed file, right click on that file and select Extract All option.
  • File can also be seen by opening that file or folder and dragging that file or folder from the zipped folder to a new location. In Windows this will automatically extract the files.
  • This file can also be opened using a software like WinZip. Download WinZip. Then download the file which is sent in email and double click on that file which will open WinZip wizard dialogue box. Clicking that presentation file from the dialogue box will open another dialogue box confirming the opening of that file. By clicking on OK the presentation file will be opened and can be viewed now.
8 0
3 years ago
Read 2 more answers
Write a python program to accept a number and check whether it is divisible by 4 or not​
Alenkasestr [34]

Answer:

number = int(input("Enter number: "))

if (number % 4):

 print("{} is not divisible by 4".format(number))

else:

 print("{} is divisible by 4".format(number))

Explanation:

If the %4 operation returns a non-zero number, there is a remainder and thus the number is not divisable by 4.

5 0
3 years ago
the guest would like to convert his 100 dollar to peso.How much will the guest receive if the exchange rate is 1 dollar=Php 50.5
Lera25 [3.4K]

Answer:

the guest receive 5050 peso if he exchange

$ 100

Explanation:

  • 1 $ = 50.50 peso
  • 1 $ × 100 = 50.50 peso × 100
  • 100 $ = 5050 peso

<em>i</em><em> </em><em>hope</em><em> </em><em>it</em><em> </em><em>helped</em><em>.</em><em>.</em><em>.</em><em>.</em>

4 0
3 years ago
Read 2 more answers
Write a program that lists all ways people can line up for a photo (all permutations of a list of strings). The program will rea
irinina [24]

Answer:

Check the explanation

Explanation:

Executable Code:

def all_permutations(permList, nameList):

   # Define the function to create a list

   # of all the permutations.

   def createPermutationsList(nameList):

       # Compute and store the length of the list.

       n = len(nameList)

       # Return an empty list if the size is 0.

       if n == 0:

           return []

       # Return the element if the size is 1.

       if n == 1:

           return [nameList]

       # Create an empty list to store the permutations.

       permList = []

       # Start the loop to traverse the list.

       for i in range(n):

           # Store the first element of the current list.

           first = nameList[i]

           # Compute the store the remaining list.

           remaining = nameList[:i] + nameList[i+1:]

           # Start the loop and call the function recursively

           # with the remaining list.

           for perm in createPermutationsList(remaining):

               # Append the element in the permutation list.

               permList.append([first] + perm)

       # Return the permutation list.

       return permList

   # Call the function to compute the permutation list

   # and store the result.

   permList = createPermutationsList(nameList)

   # Start the loop to display the values.

   for perm in permList:

       for val in perm:

           print(val, end = " ")

       print()

# Call the main() function.

if __name__ == "__main__":

   # Prompt the user to enter the input.

   nameList = input().split(' ')

   permList = []

   # Call the function to create and output

   # the permutations of the list.

   all_permutations(permList, nameList)

#endcode

3 0
3 years ago
Other questions:
  • What does a closed-envelope icon next to an e-mail message header indicate?\?
    8·1 answer
  • You will extend zyLab3, by adding a Player class and extending the PokemonField class. You will be working with three.java files
    13·1 answer
  • Why is brainly not working it say im logged out rn but im not i cant acces anything but this
    12·2 answers
  • Installing unauthorized hardware such as a communication software and modem Select one: a. Is a common practice and does not aff
    8·1 answer
  • 1. What runs horizontally and is identified with numbers?
    12·2 answers
  • A device that connects to a network without the use of cables is said to be?​
    13·1 answer
  • You do not need to remove the lead weights inside tires before recycling them. A) TrueB) False
    15·1 answer
  • The compound known as butylated hydroxytoluene, abbreviated as BHT, contains carbon, hydrogen, and oxygen. A 1.501 g sample of B
    11·1 answer
  • Kelly arrives for work at a restaurant at 5:00 p.m. Once there, she washes and chops vegetables, then sets aside ingredients and
    8·2 answers
  • Write a program that generates 100 random numbers and keeps a count of how many of those random numbers are even and how many of
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!