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]
4 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]4 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
The internet is best described as a vast
Burka [1]
The internet is best described as a vast waterfall of information.
4 0
3 years ago
Read 2 more answers
Identify two related tables in the JustLee Books database. Identify the common field between the two tables. Decide which column
Hatshy [7]

Answer:

Answers explained below

Explanation:

<u>The two related table are: </u>

i) Books Table

ii) BOOKAUTHOR Table

<u>The common field between the two tables are: </u>

i) ISBN attribute

<u>The columns that i would like to display are: </u>

Title, ISBN, AuthorID, PubID, PubDate, Cost, Retail, Discount, Category

<u>Sql Code to join tables using where clause </u>

select t1.Title, t1.ISBN, t2.AuthorID, t1.PubID, t1.PubDate, t1.Cost, t1.Retail, t1.Discount, t1.Category from Books t1 INNER JOIN BOOKAUTHOR t2 ON t1.ISBN = t2.ISBN where t1.ISBN = 0401140733

The above query will dispaly the attributes of table "Books" and of table "BOOKAUTHOR" for book ISBN 0401140733

<u>Repeat problem 1 but remove the WHERE statement </u>

After removing the where condition we will have following join query

select t1.Title, t1.ISBN, t2.AuthorID, t1.PubID, t1.PubDate, t1.Cost, t1.Retail, t1.Discount, t1.Category from Books t1 INNER JOIN BOOKAUTHOR t2 ON t1.ISBN = t2.ISBN

The above query will display all the mapping data of table "Books" and of Table "BOOKAUTHOR"

7 0
4 years ago
What command would you use to list the text files in your
frez [133]
<span>After going to the CS lab someone helped me figure out the problem. I needed to be in a certain working directory at first, and I wasn't. After switching to that directory all I needed was the command:
       ../UnixCourse/fileAsst/*.txt
       and that took care of it for me. Thanks to everyone that helped and I hope this helps someone else.</span>
4 0
3 years ago
Corey wrote a code that will display his name every time he presses the down arrow key but there is a bug in it. Display letter
brilliants [131]

Answer:

Explanation:

display letter c, type letter r, type letter o, type letter 3, type letter y- i think thats it but i dee cay this is confusing

7 0
3 years ago
Explain working principle of computer?​
Sonbull [250]

Answer:

The working principle of the computer system. Computers do the work primarily in the machine and we can not see, a control center that converts the information data input to output. This control center, called the central processing unit (CPU), How Computers Work is a very complex system.

Explanation:

5 0
3 years ago
Other questions:
  • What is the primary purpose of a business plan? To file for incorporation To help you identify your goals and plan how you will
    6·1 answer
  • One example of a Microsoft Store app is Select one: a. Photos. b. Paint. c. File Explorer. d. Notepad.
    10·1 answer
  • printArray is a method that accepts one argument, an arrayof int. The method prints the contents of the array; it does not retur
    5·1 answer
  • Which is a good guideline to follow for adding animation to a presentation?
    12·1 answer
  • This function whose primary purpose is to display information to the user can only display one value at a time.
    15·1 answer
  • Suppose the daytime processing load consists of 65% CPU activity and 35% disk activity. Your customers are complaining that the
    15·1 answer
  • Zahra's softball team needs money for team T-shirts. The coach makes some fundraising suggestions, while team members brainstorm
    5·2 answers
  • PowerPoint is a visual aid for many speakers. Discuss some points to remember when adding text to a PowerPoint presentation. How
    8·1 answer
  • 1. Assuming you are downloading a 100MB (800Mb) file on a Network that can download data at 54Mbps.
    15·1 answer
  • What are LinkedIn automation tools used for?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!