Looking for 12-FILS-L-A1-S2: Data Structures and Algorithms (CTI E, IETTI E 2024) test answers and solutions? Browse our comprehensive collection of verified answers for 12-FILS-L-A1-S2: Data Structures and Algorithms (CTI E, IETTI E 2024) at curs.upb.ro.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
At each iteration, the loop counter i is either printed or put on a depending on the result of the boolean function f (); s is an object of type , the below code cannot print certain sequences of the values of the loop counter. Is it possible the code segment could generate the output “13542”? Choose one answer.
for (i=1;i<=5;i++)
if (f()) cout<<i;
else s.push(i);
while (!s.isEmpty())
{
cout<<s.peek();
s.pop();
}
Consider and empty Q, implemented with a circular array of N = 2 positions. What is the output of the following piece of code? Choose one answer.
Queue <char> q; q. enqueue (‘h’); q. enqueue (‘i’); q. enqueue (‘o’); q. enqueue (‘u’); q. dequeue(); q. enqueue (‘t’); q. enqueue (‘p’); q. dequeue(); q. enqueue (‘a’); cout<<
Consider the usual algorithm for determining whether a sequence of parentheses is balanced. What is the maximum number of parentheses that will appear on the AT ANY ONE TIME when the algorithm analyzes: (()(())(()))?
What does the remove method do regarding priority queues?
Consider the following pseudo code. Assume that IntQueue is an integer . What does the function fun do?
void fun(int n)
{
IntQueue q = new IntQueue();
q.enqueue(0);
q.enqueue(1);
for (int i = 0; i < n; i++)
{
int a = q.dequeue();
int b = q.dequeue();
q.enqueue(b);
q.enqueue(a + b);
ptint(a);
}
}
Indicate the applications for which a
Popping in a stack means:
Suppose we have a circular array implementation of the stored at data[2] through data[11]. The current capacity is 42. Where does the insert method place the new entry in the array?
What is the value of the postfix expression 6 3 2 4 + - * :
Following is C++ like pseudo code of a function that takes a S to do processing. What does the below function do in general?
void fun(Queue *Q)
{
S; // Say it creates an empty
// Run while Q is not empty
while (!isEmpty(Q))
{
// deQueue an item from Q and push the dequeued item to S
push(&S, deQueue(Q));
}
// Run while
while (!isEmpty(&S))
{
// Pop an item from S and enqueue the poppped item to Q
enQueue(Q, pop(&S));
}
}
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!