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
What is one of the limitations of marketing in social media?.
klemol [59]

One of the limitation of the social media marketing is the risk of negative comments that can hamper the marketing strategy and certainly hamper the sales.

<h3>What is marketing?</h3>

Marketing can be defined as the advertising of the services or products into the market for making the end user aware about the product. There are various marketing tricks that can help in increasing the sales of the products or services.

Learn more about marketing, here:

brainly.com/question/13414268

#SPJ1

3 0
2 years ago
Jenny wants to create a résumé after a two-years gap. What should she consider?
gavmur [86]

She should consider jail time.

3 0
3 years ago
Read 2 more answers
Which of the following answers refers to a system containing mappings of domain names to various types of data, such as numerica
BartSMP [9]

Answer:

DNS or Domain Name System

Explanation:

You can query a DNS server with a domain name to get an IP address.

5 0
3 years ago
Are you concerned that strangers may have access to the personal information you share on social media platforms? Why or why not
GuDViN [60]
It makes me a little uneasy at times, yes, but I know that they cannot find me unless I share way too much.
Hope this helps~!
~{Oh Mrs. Believer}
4 0
3 years ago
I can’t unblock brainly from my computer, I think a robot has the same IP address .
prisoha [69]
They won’t let it be on your computer, knowing it well give you answers
6 0
3 years ago
Read 2 more answers
Other questions:
  • What do the letters of the su command stand for? what can you do with su besides give yourself root privileges? "what can you do
    5·1 answer
  • You are responsible for performing all routine maintenance on your company's laser printers. Which of the following maintenance
    15·1 answer
  • Check examples of a good work ethic. *
    6·1 answer
  • Which of the following is not an Operating System? Select one:
    13·1 answer
  • Gemima wants to order the different kinds of food alphabetically on the table. Which actions should she take? Check all that app
    8·2 answers
  • Please help explain this calculator code.
    15·1 answer
  • Hey guys im just curious.... whats ur favorite number
    6·2 answers
  • Gabriel's sister called him about a message that suddenly appeared on her screen that says her software license has expired and
    11·1 answer
  • Which are benefits of group discussions? Check all that apply. Learning becomes more interesting. Students engage in learning. L
    12·2 answers
  • In the context of computer and network security, a security system is said to possess _____ when it does not allow data to be co
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!