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
pentagon [3]
4 years ago
15

What is queue operations in datastructures?

Computers and Technology
1 answer:
ozzi4 years ago
8 0

Answer:

<u>Queue</u>- It is a data structure,unlike stacks we can insert and delete elements from both sides.

It works on the principle FiFo(first in first out) i.e the element which is inserted at the starting will be the one for deleting.  

We can perform many operations on queue like enqueue(),dequeue() and many more.

<u>Queue Operations</u>

enqueue()-This operation is used to add elements in Queue,we add element to rear.

        <u> Example-</u>

           Queue.prototype.enqueue = insertval(5)

               {  

                  this.array.push(5);  //inserting elements to a queue

                }  

dequeue()-This operation is used to remove elements from Queue,while removing data from front.  

<u> Example-</u>

           Queue. prototype. dequeue = removalval(5)

           {  

             this.array.pop(5);  //removing elements from a queue

           }

<u>peek()</u>-This operation is used to get the element from front i.e first element.

   <u>Example-</u>  

                      int peek()

                          {

                             return queue[front];

                          }

isfull()-This operation is used to check whether the queue is full or not.

 Example-

         bool isfull()

                 {

                 if(rear == MAXSIZE - 1) //checking queue is full

                     return true;

                 else

                      return false;

               }

isempty()-This operation is used to check whether the queue is empty or not.

  Example

 bool isempty()

     {

    if(front < 0 || front > rear)  //checking queue is empty or not

        return true;

   else

        return false;

     }

You might be interested in
You are researching RAM for a computer you are building for a friend who will be using the system as a home office server for he
pashok25 [27]

Answer:

ECC RAM

Explanation:

ECC RAM is the most popular Random Access Memory out there that is used by most business servers. Dealing with big data for most huge businesses is crucial. The need to prevent loss of data requires that they purchase ECC RAM. ECC RAM automatically protects the systems from potential errors that occur in memory. Any abrupt changes in temporary data stored in ECC RAM are automatically corrected. This is achieved by an additional memory chip that acts as error detection for the other eight RAM chips.

8 0
3 years ago
When you are typing data that is in a series, such as days of the week or months of the year, you can use this tool to complete
sertanlavr [38]

Answer:

Days of the week including weekends Fill Weekdays – you can autofill working days of the week excluding weekends. This is very cool. I can autofill dates excluding the weekends. Fill Months – and you can use the full word or a standard abbreviation for the month, and Excel will autofill the sequence.

Explanation:

3 0
3 years ago
Given the value x=false ,y=5 and z=1 what will be the value of F=(4%2)+2*Y +6/2 +(z&amp;&amp;x)?
Bezzdna [24]
<h2>Answer:</h2>

F = 13

<h2>Explanation:</h2>

Given:

x = false

y = 5

z = 1

F = (4%2)+2*Y +6/2 +(z&&x)

We solve this arithmetic using the order of precedence:

<em>i. Solve the brackets first</em>

=> (4 % 2)

This means 4 modulus 2. This is the result of the remainder when 4 is divided by 2. Since there is no remainder when 4 is divided by 2, then

4 % 2 = 0

=> (z && x)

This means (1 && false). This is the result of using the AND operator. Remember that && means AND operator. This will return false (or 0) if one or both operands are false. It will return true (or 1) if both operands are true.

In this case since the right operand is a false, the result will be 0. i.e

(z && x) = (1 && false) = 0

<em>ii. Solve either the multiplication or division next whichever one comes first.</em>

=> 2 * y

This means the product of 2 and y ( = 5). This will give;

2 * y = 2 * 5 = 10

=> 6 / 2

This means the quotient of 6 and 2. This will give;

6 / 2 = 3

<em>iii. Now solve the addition by first substituting the values calculated earlier back into F.</em>

F = (4%2)+2*Y +6/2 +(z&&x)

F = 0 + 10 + 3 + 0

F = 13

Therefore, the value of F is 13

5 0
3 years ago
Given the char * variables name1, name2, and name3, write a fragment of code that assigns the largest value to the variable max
Assoli18 [71]

Answer:

The following code as follows:

Code:

max=name1;   //define variable max that holds name1 variable value.

if (strcmp(name2, max)>0)  //if block.

{

   max=name2;  //assign value to max.

}

if (strcmp(name3,max)>0)   //if block.

{

  max=name3; //assign value to max.

}

Explanation:

In the above code, we define a variable that is max. The data type of max variable is the same as variables "name1, name2, and name3" that is "char". In the max variable, we assign the value of the name1 variable and use if block statement two times. In if block, we use strcmp() function that can be defined as:

  • In first if block we pass two variables in strcmp() function that is "name2 and max" that compare string value. If the name2 variable is greater then max variable value so, the max variable value is change by name2 variable that is "max=name2".
  • In second if block we pass two variables in strcmp() function that is "name3 and max" that compare string value. If the name3 variable is greater then max variable value so, the max variable value is change by name3 variable that is "max=name3".

4 0
3 years ago
Hi what is full form of ugst​
AURORKA [14]

Answer:

UGST – Union Territory Goods & Services Tax.

4 0
3 years ago
Read 2 more answers
Other questions:
  • What does delegating access give someone the permission to do on behalf of the user? Choose two answers.
    5·1 answer
  • During slideshow mode hitting the b key will do which of these
    5·1 answer
  • You can clear a log file simply by redirecting nothing into it. true or false?
    13·1 answer
  • Which of the following payment types require you to pay upfront?
    9·1 answer
  • In Excel, you can sort a table by one or more columns by.
    7·1 answer
  • Why is yo utu be down?<br> (You restrict talking about yo utu be, really)
    11·2 answers
  • I really need this done Thank you!!
    6·1 answer
  • What does a pencil icon in the row selector area indicate?
    7·1 answer
  • 1. Write an if statement that assigns 20 to the variable y, and assigns 40 to the variable z
    10·1 answer
  • Write a function that accepts a positive random number as a parameter and returns the sum of the random number's digits. Write a
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!