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
Which feature of spreadsheet software will make it easier for you to find the average number of calls made per hour for each emp
max2010maxim [7]

Answer:

It's formula and functions

Explanation:

6 0
3 years ago
Limitations of systems analysis and design​
Sonja [21]

Answer:

<h3 />

Explanation:

<h3>Although System analysis offers an extensive range of benefits it might also have some disadvantages. One of the main disadvantages which is mostly overlooked is the risk of too much analysing which may be costly and time consuming. It is therefore part of the analyst's job to find the right balance.</h3>
6 0
3 years ago
What item on a business card is generally the most prominent?
AveGali [126]
The most prominent
Company name that's most important
3 0
3 years ago
Read 2 more answers
The grade of a metric bolt is designated by
Andre45 [30]
The answer to your question is The grade of a metric bolt is designated by the number stamped on the head of the bolt.
5 0
3 years ago
Describe the information technology industry today
Volgvan

Answer:

The information technology (IT) sector includes companies that produce software, hardware, or semiconductor equipment, and companies that provide internet or related services.

Explanation:

6 0
2 years ago
Other questions:
  • For C++ (please make sure it runs properly)
    14·1 answer
  • When troubleshooting a desktop motherboard, you discover the network port no longer works. What is the best and least expensive
    10·1 answer
  • The operating system of a computer is an example of ________ software. science-forum
    7·1 answer
  • Which is an example of a student practicing ethical behavior online??
    7·2 answers
  • ____ is typically used with lans that have a star topology and can be used in conjunction with twisted-pair, coaxial, or fiber-o
    12·1 answer
  • Many languages distinguish between uppercase and lowercase letters in user-defined names. What are the pros and cons of this des
    8·1 answer
  • Explain what led to the invention of lasers
    7·1 answer
  • Which graphic file format is used for commercial purposes.
    10·1 answer
  • Write a function called no_you_pick. no_you_pick should have two parameters. The first parameter is a dictionary where the keys
    5·1 answer
  • What is the outcome when a floating-point number is divided by zero?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!