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
Makovka662 [10]
3 years ago
14

Suppose we have two String objects and treat the characters in each string from beginning to end in the following way: With one

string, we push each character on a stack. With the other string, we add each character to a queue. After processing both strings, we then pop one character from the stack and remove one character from the queue, and compare the pair of characters to each other. We do this until the stack and the queue are both empty. What does it mean if all the character pairs match?
Computers and Technology
1 answer:
Simora [160]3 years ago
6 0

Answer:

If all the character pairs match after processing both strings, one string in stack and the other in queue, then this means one string is the reverse of the other.                            

Explanation:

Lets take an example of two strings abc and cba which are reverse of each  other.

string1 = abc

string2 = cba

Now push the characters of string1 in stack. Stack is a LIFO (last in first out) data structure which means the character pushed in the last in stack is popped first.

Push abc each character on a stack in the following order.

c

b

a

Now add each character of string2 in queue. Queue is a FIFO (first in first out) data structure which means the character inserted first is removed first.

Insert cba each character on a stack in the following order.

a   b   c

First c is added to queue then b and then a.

Now lets pop one character from the stack and remove one character from queue and compare each pair of characters of both the strings to each other.

First from stack c is popped as per LIFO and c is removed from queue as per FIFO. Then these two characters are compared. They both match

c=c. Next b is popped from stack and b is removed from queue and these characters match too. At the end a is popped from the stack and a is removed from queue and they both are compared. They too match which shows that string1 and string2 which are reverse of each other are matched.

You might be interested in
If a password is entered wrongly three times the computer will
Vinvika [58]

Answer:lock

Explanation:its a sicuraty thing

5 0
2 years ago
What kind of a bug is 404 page not found
Allisa [31]

Answer:A 404 error is often returned when pages have been moved or deleted. ... 404 errors should not be confused with DNS errors, which appear when the given URL refers to a server name that does not exist. A 404 error indicates that the server itself was found, but that the server was not able to retrieve the requested page.

Explanation: Hope this helps

7 0
3 years ago
Read 2 more answers
I am a bacterium. I cause stomach cramps and diarrhea. I am caused by eating rotten foods
ZanzabumX [31]

I think it's salmonella. : )

4 0
3 years ago
Read 2 more answers
When you save a drawing using paint, it's automatically stored as a?
serious [3.7K]

Answer:

Bitmap File

Explanation:

6 0
3 years ago
Write a JavaScript statement to convert "Information Technology" to uppercase.
OLEGan [10]

Answer:

The JavaScript  statement is

var str1 =    "Information Technology";

var result = str1.toUpperCase();

Explanation:

JavaScript  is used to validate the client side it means it provide the client side validation.

Following are the function of JavaScript that converted the string into uppercase.

 function val()

{

 var str1 = "Information Technology ";

 var result = str1.toUpperCase();

}

The toUpperCase() function convert the string into uppercase in JavaScript

OUTPUT  

INFORMATION TECHNOLOGY

4 0
2 years ago
Other questions:
  • What part of the communication feedback loop results in unclear communication?
    13·1 answer
  • What is Mainframe computer​
    15·1 answer
  • Solve the following quadratic equation <br><br>y=6x^2-12x+1
    9·1 answer
  • Why computer process faster than humans?​
    10·2 answers
  • 2. The factorial of a positive integer n is the product of the integers from 1 to n. You can express the factorial of a positive
    6·1 answer
  • Write an algorithm that accepts two numbers,
    7·1 answer
  • 1. select the correct answer from the given options.
    5·1 answer
  • Pls help computer science I will give brainliest
    8·2 answers
  • RTOS stands for ______ Time Operating System.
    11·1 answer
  • 2. How much did John Jones have in his account on the first day of the
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!