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
Is I5 9100 is better than i5 9400
IrinaVladis [17]

Answer:

Personally, Yes.

Explanation:

I say this completely on a personal level, and also looking at the stats. Looking at the stats, its a cheaper, and faster model.  9100 at 3.5GHz whereas 9400 runs at 2.9GHz. On turbo speed, it runs up to 4.2GHz, where as the 9400 runs at 4GHz. The price is 100 dollars less on the 9100. there are 2 more physical cores on the 9400, but that doesnt neccesarily mean its a bad desktop. Also, its CPU mark is about 2000% higher than the 9400.

Hope this helped.

3 0
4 years ago
500 word career report, auto care
lilavasa [31]

???????????????????????

8 0
3 years ago
write an algorithm that gets two values: the price for item A and the quantity purchased. The algorithm should then print the to
pochemuha

Answer:

Explanation:

price = eval(input("price of item: "))

quantity = eval(input("quantity of item: "))

sales_tax = 0.08 # 8% sales tax

total_cost = price*quantity

total_cost_with_tax = total_cost + total_cost*sales_tax

print("total cost: "+str(total_cost))

print("total cost + 8% sales tax: "+str(total_cost_with_tax))

5 0
4 years ago
Write a function call using the ebay_fee() function to determine the fee for a selling price of 15.23, storing the result in a v
Sholpan [36]

Answer:

my_fee = ebay_fee(15.23)

Explanation:

Functions are sections of a program that provide a particular outlined procedure, we call a function by writing its name followed by a pair of parenthesis, the function may be designed in a way that it accepts arguments while been called, Like the case of the ebay_fee(15.23). the number within the pair of parenthesis id the argument, and it is the data that the functions will process and return a value afterwards.

7 0
4 years ago
EXERCISE 3
balandron [24]

Answer:

The BASIC program is as follows:

SUM = 0

FOR I = 1 TO 20

INPUT SCORES

SUM = SUM + SCORES

NEXT I

AVERAGE = SUM/20

PRINT AVERAGE

Explanation:

This initializes sum to 0

SUM = 0

This iterates through 20

FOR I = 1 TO 20

This reads each score

INPUT SCORES

This calculates the total scores

SUM = SUM + SCORES

NEXT I

This calculates the average

AVERAGE = SUM/20

This prints the calculated average

PRINT AVERAGE

5 0
3 years ago
Other questions:
  • When sending a packet of data from source host to a destination host over a fixed route. Which of the delay components are varia
    8·1 answer
  • You have implemented a network where each device provides shraed files with all other devices on the network. what type of netwo
    10·1 answer
  • Which of the following is a bad password? Select one: a. The acronym for the title of your favorite song plus the year it came o
    11·1 answer
  • Refer to the exhibit. A network administrator is configuring PAT on an ASA device to enable internal workstations to access the
    12·1 answer
  • How do motion sensors determine in simation
    13·1 answer
  • PLEASE HELP 10 POINTS!!!Click this link to view O*NET’s Work Activities section for Human Resources Managers. Note that common a
    7·2 answers
  • Please help me on this I don't know which one they are​
    6·2 answers
  • What website or search engine that helps people find the web pages that they are looking for by tying in the subject they want?​
    5·1 answer
  • Could anyone beat my typing?<br><br> https://keyma.sh/custom/33K7C
    5·1 answer
  • Moses wants to update the interface of a router. He plans on having a check on the current running configuration file and then w
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!