Skip to content

Latest commit

 

History

History

5_StacksTailsStructures

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Stacks and Queues in C++

Costa Rica

Belinda Brown, [email protected]

GitHub brown9804

June 2019


Stacks and Queues are fundamental data structures in computer science that are used in various types of computation.

Stacks

A Stack is a linear data structure that follows a particular order in which operations are performed. The order may be LIFO(Last In First Out) or FILO(First In Last Out). Mainly the following three basic operations are performed in the stack:

  1. Push: Adds an element to the collection.
  2. Pop: Removes an element from the collection.
  3. Peek/Top: Returns the topmost element without removing it.

Queues

A Queue is a linear structure which follows a particular order in which the operations are performed. The order is First In First Out (FIFO). A good example of a queue is any queue of consumers for a resource where the consumer that came first is served first. The difference between stacks and queues is in removing. In a stack we remove the item the most recently added; in a queue, we remove the item the least recently added.

How to run

To run the program, you need to navigate to the folder containing the program using your console or terminal.

For the "Balanceo_signos_agrupacion" Program

  1. Navigate to the "Balanceo_signos_agrupacion" folder.
  2. Once inside the folder, type the following command in the console or terminal:
$ make

For the “Prioridad” Program

  1. Navigate to the “Prioridad” folder.
  2. Once inside the folder, type the following command in the console or terminal:
$ make

The above command compiles the code. To run the compiled program, type the following command:

 ./prioridad.exe 4 1:1:2:1