3 Nov 2015 - 12:24pm

A). First, let us define Activation. An activation is an execution of a subprogram. In a language with recursion, each simultaneous activation of a recursive subprogram can have different parameters, different values for local variables, return a different result etc. So, storage is needed for these values, which is called as Activation record also called as stack frame.

B). Activation records can be allocated on -

Stack area : more efficient. Used in C, C++, Java etc.

Heap area : more flexible. Used in LISP, Modula-3, Scheme etc.

Static area : when nested functions involved. Used in Tiger etc.

3 Nov 2015 - 12:12pm

In C++ Operator overloading allows the use of operators to be extended to work not just with built-in types but also classes. A programmer can provide his or her own operator to a class by overloading the built-in operator to perform some specific computation when the operator is used on objects of that class. In the below example, addition (+) operator is overloaded to perform addition of two Box class objects.

#include <iostream>
using namespace std;

class Box
{
private:
double length;      // Length of a box
double height;      // Height of a box

public:
void setLength( double len )
{
length = len;
}

{
}

void setHeight( double hei )
{
height = hei;
}

double getVolume(void)
{
return length * breadth * height;
}

Box operator+(const Box& b)
{
Box box;
box.length = this->length + b.length;
box.height = this->height + b.height;
return box;
}
};

// Main function for the program
int main( )
{
Box Box1;                // Declare Box1 of type Box
Box Box2;                // Declare Box2 of type Box
Box Box3;                // Declare Box3 of type Box
double volume = 0.0;     // Store the volume of a box here

// box 1 specification
Box1.setLength(6.0);
Box1.setHeight(5.0);

// box 2 specification
Box2.setLength(12.0);
Box2.setHeight(10.0);

// volume of box 1
volume = Box1.getVolume();
cout << "Volume of Box1 : " << volume <<endl;

// volume of box 2
volume = Box2.getVolume();
cout << "Volume of Box2 : " << volume <<endl;

// Add two object as follows:
Box3 = Box1 + Box2;

// volume of box 3
volume = Box3.getVolume();
cout << "Volume of Box3 : " << volume <<endl;

return 0;
}

2 Nov 2015 - 12:45pm

Yes, it is correct.

2 Nov 2015 - 11:31am

Since, V8 is starting vertex, so it is pushed initially onto the stack.

STACK : V8

Now, V8 has four neighbors V4, V5, V6, V7, so these are pushed onto the stack and V8 is marked as visited.

STACK : V4, V5, V6, V7

Now, V7 has only one neighbor V3, so it is pushed onto the stack and V7 is marked as visited.

STACK : V4, V5, V6, V3

Now, V3 has two neighbors V6 and V1, so these are pushed onto the stack and V3 is marked as visited.

STACK : V4, V5, V6, V1, V6

Now, V6 has no unvisited neighbors, so it is marked as visited.

STACK  :  V4, V5, V6, V1

Now, V1 has only one neighbor V2, so it is pushed onto the stack and V1 is marked as visited.

STACK : V4, V5, V6, V2

Now, V2 has two neighbors V4 and V5, so these are pushed onto the stack and V2 is marked as visited.

STACK :  V4, V5, V6, V4, V5

Thus, we can see that 3 vertices are pushed twice V4, V5 and V6.

30 Oct 2015 - 4:59pm

No, g(a2) means g(second character) in string s = a1a2....an, which further is an element from the set Σ = {a,b,c,d,e}.

30 Oct 2015 - 4:37pm

It is not clear from the question that on which column the join is to be performed. Assuming it is to be performed on attribute 'r' of both tables.

The minimum no. of rows returned will be 250. It happens when each value of attribute 'r' of table R1 is unique, in that case, each row of R1 will make join with exactly one row of table R2, thus resulting in 200 rows. Also, all the rows of table R2 will be there in the result, so the remaining 50 rows of table R2 will also be included in the result. Thus, total 250 rows will be there.

The maximum no. of rows returned will be 449. It happens when all values of attribute 'r' of table R1 are same, in that case, each row of R1 will make join with only one row of table R2, thus resulting in 200 rows. Also, all the rows of table R2 will be there in the result, so the remaining 249 rows of table R2 will also be included in the result. Thus, total 449 rows will be there.

30 Oct 2015 - 4:00pm

Heap Data Structure is best to implement Priority Queue. More specifically max heap or min heap depending upon the priority criteria.

30 Oct 2015 - 3:30pm

Yes, these tables are sufficient enough to get the required information asked in the question. What i didn't get is what top ten customers meant specifically?

My guess is if it is according to no of transactions performed in total by a customer.

15 Oct 2015 - 11:45am

No, there isn't anything wrong. You got it absolutely right.

2 Feb 2015 - 12:41pm