Answer:
B. the current affairs page
Explanation:
it's a simple question
The answer is c that what a lot of people use☻
Answer:
Thank you for the free points.
Answer:
static int checkSymbol(char ch)
{
switch (ch)
{
case '+':
case '-':
return 1;
case '*':
case '/':
return 2;
case '^':
return 3;
}
return -1;
}
static String convertInfixToPostfix(String expression)
{
String calculation = new String("");
Stack<Character> operands = new Stack<>();
Stack<Character> operators = new Stack<>();
for (int i = 0; i<expression.length(); ++i)
{
char c = expression.charAt(i);
if (Character.isLetterOrDigit(c))
operands.push(c);
else if (c == '(')
operators.push(c);
else if (c == ')')
{
while (!operators.isEmpty() && operators.peek() != '(')
operands.push(operators.pop());
if (!operators.isEmpty() && operators.peek() != '(')
return NULL;
else
operators.pop();
}
else
{
while (!operators.isEmpty() && checkSymbol(c) <= checkSymbol(operators.peek()))
operands.push(operators.pop());
operators.push(c);
}
}
while (!operators.isEmpty())
operands.push(operators.pop());
while (!operands.isEmpty())
calculation+=operands.pop();
calculation=calculation.reverse();
return calculation;
}
Explanation:
- Create the checkSymbol function to see what symbol is being passed to the stack.
- Create the convertInfixToPostfix function that keeps track of the operands and the operators stack.
- Use conditional statements to check whether the character being passed is a letter, digit, symbol or a bracket.
- While the operators is not empty, keep pushing the character to the operators stack.
- At last reverse and return the calculation which has all the results.
Answer and explanation :
the three control problems associated with competing process are
- MUTUAL EXCLUSION : We know that some resources are shareable and some are not shareable. which means only one process can access the resource at a time this type of resources are called critical resources this code can be access at only one process at a time. the other process if required to access should not be allowed
- DEADLOCK: this hold the process without complete for example suppose there are two resources R1 and R2 and two process P1 and P2 and P1 use R1 and P2 use R2 but after some time when P1 needs R2 but R2 is not available as it is used by P2 so the all process will be on hold
- STARVATION : when priorities are given to the process as high priorities and low priorities. And high priorities process always competing then low priorities process have to wait for very long time this is called starvation