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
Elina [12.6K]
3 years ago
13

. Given an initially empty stack s that accepts integers, the following operations are performed: s.push (10) s.push (20) s.push

(30) s.push (40) s.pop () s.pop () s.push (50) s.push (60) s.push (70) s.pop () s.pop () s.push (80) s.push (90) s.pop ()
a) Write out the composition of the stack after these operations. b) What sequences of integers was popped off the stack?
Computers and Technology
1 answer:
sp2606 [1]3 years ago
4 0

Answer:

a) The composition of the stack is :- 80,50,20,10.

Where 80 is the top and 10 is the last element.

b) The sequence of the popped items 40,30,70,60,90.

Explanation:

Stack is LIFO type data structure means Last in First Out.The element inserted last will be out of the stack first.The removal and addition is only at the one end that is top.

First 10,20,30,40 will be inserted in the stack. 40 is a the top.Now two pop operations occurs. 40 and 30 will be removed from the stack.

Now 50,60,70 will be inserted in the stack then again two pop operations so 70 and 60 will be removed from the stack.

Now the stack contains 50,20,10.Top = 50.

80 and 90 are added to the stack and 1 pop operation that is 90 will be removed.

Stack is 80,50,20,10 . Top = 80.

Sequence of integers popped=40,30,70,60,90.

You might be interested in
How can the use of new technology in industry benefit the us government
Karo-lina-s [1.5K]
It Can Benefit Them Because This Generation Uses Technology And Such We Don't Live In A Primary Source World Where We Write Letters And Send Them Away To Where Ever Country , We A Secondary Country Because Now We Use Technology And We Are More Advance With Things Which Benefits Us Even More In Bigger And Better Ways
5 0
3 years ago
Read 2 more answers
What is the main characteristic of a Peer-to-Peer (P2P) network?
Setler [38]

Answer:

A peer-to-peer (p2p) network provides a scalable and fault-tolerant mechanism to locate nodes anywhere on a network without maintaining large amount of routing state. This allows for a variety of applications beyond simple file sharing, including in multicast systems, anonymous communications systems, and web caches.

Explanation:

Not hard at all ma'am.

6 0
3 years ago
This program outputs a downwards facing arrow composed of a rectangle and a right triangle. The arrow dimensions are defined by
andreyandreev [35.5K]

Answer:

Follows are the modified code to this question:

#include <stdio.h>//defining a herader file

int main(void) //defining a main method

{

  int arrowBaseHeight = 0,arrowBaseWidth = 0,arrowHeadWidth = 0 ;//defining integer variable

  int i, j; //defining integer variable

  printf("Enter arrow base height:");//print message  

  scanf("%d", &arrowBaseHeight);//input value in arrowBaseHeight variable

  printf("Enter arrow base width:");//print message

  scanf("%d", &arrowBaseWidth);//input value  in arrowBaseWidth variable

  while (arrowHeadWidth <= arrowBaseWidth)//defining while loop to check arrowHeadWidth less then equal to arrowBaseWidth  

  {

      printf("Enter arrow head width:");//print message

      scanf("%d", &arrowHeadWidth);//input value in arrowHeadWidth variable

      printf("\n");//use for line spacing

  }

  // defining for loop for print vertical line of asterisk

  for (i = 0; i < arrowBaseHeight; i++)//defining for loop for print row  

  {

      for (j = 0; j < arrowBaseWidth; j++) //defining for loop for print column

      {

          printf("*");//print asterisk value

      }

      printf("\n");//use for line spacing

  }

//defining for loop for print reverse triangle

  for (i = arrowHeadWidth; i > 0; i--) //defining loop for input length  

  {

      for (j = i; j > 0; j--) //defining loop for triangle  

      {

          printf("*"); //print asterisk value

      }

      printf("\n");//use for line spacing

  }

  return 0;

}

Output:

please find attach file.

Explanation:

In the code, inside the method five integer variable "arrowBaseHeight, arrowBaseWidth, arrowHeadWidth, i, and j" is defined, in which the first three variables are used for input value from the user end, and "i and j" are used in the loop.

In the next step while loop is used for input the value, but in this code, mainly two for loop is used which can be defined as follows:

  • In the first loop, it is used the "arrowBaseHeight and arrowBaseWidth" variable to print the vertical line of the asterisk.
  • In the second loop, it uses the "arrowHeadWidth" variable to print the reverse triangle.

6 0
3 years ago
How does the post process alert the user if it detects a hardware problem during the post process?
Lesechka [4]
As a Alert down by the bar under where it says start I would think.
6 0
3 years ago
Why does my internet keep disconnecting and reconnecting.
3241004551 [841]

Answer:

Hmm maybe because its failing?

Explanation:

i actually dont know but it happens to me sometimes

6 0
2 years ago
Other questions:
  • Drag the correct type of update to its definition.
    5·1 answer
  • Which of the following would an interactive media proffessional must likely need
    9·1 answer
  • Which principle of CSR requires that a business state facts fully and accurately?
    8·1 answer
  • Which of these jobs would be most appropriate for someone who majors in computer engineering? ANSWER FAST PLEASE
    15·2 answers
  • Each AWS region is composed of two or more locations that offer organizations the ability to operate production systems that are
    7·1 answer
  • Coal, nuclear and natural gas power plants all transform thermal energy into electricity
    14·2 answers
  • Choose the best type of loop for each situation.
    6·1 answer
  • Guess The Song:
    9·1 answer
  • I need help so bad it’s the entire test for EdHesive python coding Test 2
    5·1 answer
  • What statement describes the last step in evaluating<br> information?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!