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
bonufazy [111]
4 years ago
7

Contrast and compare: an array, a stack, and a queue. Identify the principal uses of each and give an example.

Computers and Technology
1 answer:
Soloha48 [4]4 years ago
8 0

Answer:

All three of them are linear Data Structures.

A stack is a FILO(First In Last Out) or LIFO(Last In First Out)  type data structure means first inserted element will be the last one to be removed form the stack.Insertion and Deletion is from one end only called head.

ex:-A stack of books on the shelf.

A queue is FIFO(First In First Out) type means the first inserted element will be the first one to be removed.In queue insertion is from the back or tail and removal of elements is done form the front.

ex:-A queue at the ticket counter.

In array each element stored is given an index, by which we can be access the element very easily. We can use this index to modify or store element at that index of the array. i.e any object can be accessed with the right index, unlike queue and stack.

We can access only the front and back in the queue.In stack we can access only the top but in array we can access any element with the index.

You might be interested in
Write a program to read as many test scores as the user wants from the keyboard (assuming at most 50 scores). Print the scores i
Oksana_A [137]

Answer: Provided in the explanation segment

Explanation:

Below is the code to carry out this program;

/* C++ program helps prompts user to enter the size of the array. To display the array elements, sorts the data from highest to lowest, print the lowest, highest and average value. */

//main.cpp

//include header files

#include<iostream>

#include<iomanip>

using namespace std;

//function prototypes

void displayArray(int arr[], int size);

void selectionSort(int arr[], int size);

int findMax(int arr[], int size);

int findMin(int arr[], int size);

double findAvg(int arr[], int size) ;

//main function

int main()

{

  const int max=50;

  int size;

  int data[max];

  cout<<"Enter # of scores :";

  //Read size

  cin>>size;

  /*Read user data values from user*/

  for(int index=0;index<size;index++)

  {

      cout<<"Score ["<<(index+1)<<"]: ";

      cin>>data[index];

  }

  cout<<"(1) original order"<<endl;

  displayArray(data,size);

  cout<<"(2) sorted from high to low"<<endl;

  selectionSort(data,size);

  displayArray(data,size);

  cout<<"(3) Highest score : ";

  cout<<findMax(data,size)<<endl;

  cout<<"(4) Lowest score : ";

  cout<<findMin(data,size)<<endl;

  cout<<"(5) Lowest scoreAverage score : ";

  cout<<findAvg(data,size)<<endl;

  //pause program on console output

  system("pause");

  return 0;

}

 

/*Function findAvg that takes array and size and returns the average of the array.*/

double findAvg(int arr[], int size)

{

  double total=0;

  for(int index=0;index<size;index++)

  {

      total=total+arr[index];

  }

  return total/size;

}

/*Function that sorts the array from high to low order*/

void selectionSort(int arr[], int size)

{

  int n = size;

  for (int i = 0; i < n-1; i++)

  {

      int minIndex = i;

      for (int j = i+1; j < n; j++)

          if (arr[j] > arr[minIndex])

              minIndex = j;

      int temp = arr[minIndex];

      arr[minIndex] = arr[i];

      arr[i] = temp;

  }

}

/*Function that display the array values */

void displayArray(int arr[], int size)

{

  for(int index=0;index<size;index++)

  {

      cout<<setw(4)<<arr[index];

  }

  cout<<endl;

}

/*Function that finds the maximum array elements */

int findMax(int arr[], int size)

{

  int max=arr[0];

  for(int index=1;index<size;index++)

      if(arr[index]>max)

          max=arr[index];

  return max;

}

/*Function that finds the minimum array elements */

int findMin(int arr[], int size)

{

  int min=arr[0];

  for(int index=1;index<size;index++)

      if(arr[index]<min)

          min=arr[index];

  return min;

}

cheers i hope this help!!!

8 0
3 years ago
All of the following methods ensure the stored data are unreadable except…?
Nikitich [7]

Answer:

Option D i.e., Removing the volume header information is the correct option.

Explanation:

In the above statement, the volume header includes the data related to the volume of the hard drive and each of them includes an isolated header of the volume or its group.  

The size of the volume header is not greater than 1000-KB. It build at the time of the installation of an Operating System in the computer system.

5 0
4 years ago
A user logging on, an application server connecting to a database server, an authentication server rejecting a password, or an a
ser-zykov [4K]
<span>The answer is Event.  A user logging on, an application server connecting to a database server, an authentication server rejecting a password, or an antivirus scanner reporting a suspected virus are all examples of Event.
</span>
4 0
4 years ago
Jason is an aspiring filmmaker. He manages finance and makes sure that everyone is involved in the project. Which role is Jason
lana66690 [7]

Answer:

a film producer.

is the role he is playing

7 0
3 years ago
A(n) ________ software installation enables you to decide which features you want to install on the hard drive
Mazyrski [523]
<span>An element in the Excel window that displays the value or formula contained ... which you can specify the type of calculation you want to perform in an Excel formula are: ..... installs all the most commonly used files to your computer's hard drive. Full. A(n) ______ software installation enables you to decide which features you ...</span><span>
</span>
5 0
4 years ago
Other questions:
  • When did project management first emerge as a profession
    6·1 answer
  • ____ are the computers that store network software and shared or private user files.
    6·1 answer
  • What software development model focuses on improving the product in small steps each time through the cycle?
    14·2 answers
  • You are a police officer trying to crack a case. You want to check whether an important file is in the evidence room. Files have
    5·2 answers
  • The functions of forums
    15·1 answer
  • Which line of code will print I can code on the screen?
    13·1 answer
  • what is the ability to carry out financial transactions using mobile devices such as tablets and phones?
    5·1 answer
  • Fill in the blank: _________ is Google’s machine-learning artificial intelligence system that interprets people’s searches to fi
    9·1 answer
  • String member function compare compares two strings (or substrings) and returns 0 if:
    5·1 answer
  • Zoom and Adobe Acrobat Reader are freeware programs. What does this
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!