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
kondaur [170]
2 years ago
7

What is the worst case complexity of the push operation for an array-based stack?

Computers and Technology
1 answer:
aev [14]2 years ago
6 0

Worst Case Scenario would be O(n) in case of an array implementation of the stack where the array is filled, then the array size needs to be changed and all the elements must be copied from one array to another, this would result in time being O(n).

<h3>What is an array-based stack?</h3>

The array-based stack performance is a simplified version of the array-based list. The only important design decision to be made is which end of the array should define the top of the stack. One option is to create the top at position 0 in the array.

To learn more about Array-based stack, refer to:

brainly.com/question/20490030

#SPJ4

You might be interested in
Ask the user for two numbers. Print only the even numbers between them. You should also print the two numbers if they are even.
madreJ [45]

I've included the code in the picture below.

5 0
3 years ago
Letter Frequency Write a function that will take a string and return a count of each letter in the string. For example, "my dog
Nostrana [21]

Answer:

Check the explanation

Explanation:

Code to copy:

// ConsoleApplication7.cpp : Defines the entry point for the console application.

//

#include "stdafx.h"

#include <iostream>

#include <cstring>

#include <string>

using namespace std;

int * letterFrequency(char s[]);

int main()

{

  int *freq_letters;

  char *s = new char[100];

  freq_letters = new int[26];

  //To read the input string in order to find the frequency of each letter

  cout << "Enter a string: ";

  cin.getline(s, ' ');

  //call the function to find the occurrence of each alphabet

  freq_letters = letterFrequency(s);

  //Display the count

  cout << "Letter Frequency " << endl;

  for (int i = 0; i < 26; i++)

  {

      //Constriant to check if the letter appeared at least once in the string and so printing the frequency of its occurence

      if (freq_letters[i] != 0)

      cout << " " << static_cast<char>(i + 'a') << " " << freq_letters[i] << endl;

  }

  system("pause");

  return 0;

}

//Define the function to find occurrence of each letter in the input string

int * letterFrequency(char s[])

{

  int *occurrence_array;

//to store the output of occurrences for each alphabet

  occurrence_array = new int[26];

// to store the count of occurrence for each letter temporarily

  int letter_count;

  // for loop to check the occurrence for all 26 alphabets

 

  for (int i = 0; i < 26; i++)

  {

      letter_count = 0;

      for (int j = 0; j < strlen(s); j++)

      {

          /*comparing the ascii values of each alphabet with every character from the string by converting it to lower case i.e. case insensitive*/

          if (int('a') + i == int(tolower(s[j])))

              letter_count++;

      }

      occurrence_array[i] = letter_count;//To store the count calculated for each alphabet

  }

  return occurrence_array;

}

The following below code screenshot and output shows that when the string is entered, the output will shows each lettercount irrespective of whether the letter is in capitals or small and does not count non-letter characters (i.e spaces, punctuations etc.)

6 0
4 years ago
If you sort a portion of an Excel sheet and you get an error message such as #DIV/0, what is a likely cause of the error message
yulyashka [42]
<span>If you sort a portion of an Excel sheet and you get an error message such as #DIV/0, the cause of the error message is (B) one or more cells containing absolute cell references. The possible reason of this error message includes: (1) e</span><span>ntering division formula that divided by zero (0), (2) and that is being used as a reference.</span>
7 0
3 years ago
Write a program that uses the function isPalindrome given in Example 6-6 (Palindrome). Test your program on the following string
Artist 52 [7]

Answer:

#include <bits/stdc++.h>

using namespace std;

bool isPalindrome(string str)

{

   char a,b;

int length = str.length();

for (int i = 0; i < length / 2; i++)

{

   a=tolower(str[i]);//Converting both first characters to lowercase..

   b=tolower(str[length-1-i]);

   if (b != a )

return false;

}

return true;

   

}

int main() {

   string t1;

   cin>>t1;

   if(isPalindrome(t1))

   cout<<"The string is Palindrome"<<endl;

   else

   cout<<"The string is not Palindrome"<<endl;

return 0;

}

Output:-

Enter the string

madam

The string is Palindrome

Enter the string

abba

The string is Palindrome

Enter the string

22

The string is Palindrome

Enter the string

67876

The string is Palindrome

Enter the string

444244

The string is not Palindrome

Explanation:

To ignore the cases of uppercase and lower case i have converted every character to lowercase then checking each character.You can convert to uppercase also that will also work.

6 0
3 years ago
SRV02 holds a shared folder named Forecast for the managers group. Maria is a member of the managers group. You would like to gr
belka [17]

Answer:

You need to enter to the server restrictions panel (it depends on which server you are using). Just like you granted full permission to the other members in the managers group, you need to add Maria to the group, but restricting her access to read-only, so she would only be able to view the files without modifying or erasing them.

Explanation:

8 0
4 years ago
Other questions:
  • Describe the concepts of Defense in Depth and Detection in Depth. Compare and contrast. What's different? What's similar?
    9·1 answer
  • Which expense is a bank least likely to extend a line of credit for?
    13·2 answers
  • What advantage does having ultraviolet vision give bees?
    10·2 answers
  • Pressing and holding the _______ key while dragging a corner handle of an image proportionally resizes it.
    5·2 answers
  • Gary frequently types his class assignment. His ring automatically types the letter O. What is Gary using when he types?
    10·2 answers
  • The (X , y) coordinates of a certain object as a function of time' are given by Write a program to determine the time at which t
    6·1 answer
  • Anyone wanna play Bloons tower defense 5 im rank 52
    5·2 answers
  • Can some one give me a april fools joke i can do to my teacher
    12·1 answer
  • How do i mark answers brainliest on brainly
    11·2 answers
  • Who is the first computer programmer​
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!