Arvind is presently a M.Tech(CSE) final year student in IIT Kharagpur, India. He has recently got a job offer in EPIC and also from companies like Cisco, TCS etc. Arvind is sincere, disciplined and a reliable kind of person who reaches out for a person in need. So if you are confused about something while preparing for GATE, feel free to ask him, he will be happy to help you.

Not updated.

Experience:

Not updated.
Tud
2 years 1 month ago

The approach is absolutely correct. However, there is an error in the calculation. Sum of first n terms is n(n+1)/2 :).

moreless
Tud
2 years 1 month ago

Sorry didnt get the time to explain the example suggested. Here it follows:

First push 8  pop 8, push 4 pop 4, push 2 pop 2, push1.
After that push 8 pop 8, push 4 pop 4, push 2.
Again push 8 pop 8, push 4.
Finally push 8.

So, at each step we can see that a pattern is followed and if we relate it with n, then we get 2n-1, 2(n-1)-1, 2(n-2)-1 .... 2(1)-1 respectively. So, adding all these terms, we get
2(n + n-1 + n-2 +......+ 1) - n = 2(n(n+1)/2) - n = n2 + n - n = n2.

moreless
Tud
2 years 1 month ago

The maximum possible number of iterations will be n2 which occurs when the numbers are stored in increasing order in Q. It can be proved by taking an example. Take the initial Q as 8,4,2,1. Now execute the given code.

moreless
Tud
2 years 1 month ago

This program will output 8. The logic is:
first the expression within () is solved. There are three expressions within () separated by comma. The first expression will result in making  a value as 4, the second expression is constant 5 and the third expression is a whose value is now 4.
Now the twist is comma is treated as operator in C, which has left associativity, so the () will return last expression i.e. a with value 4. So, the final expression will be a+=a which results in a value as 8.

moreless
Tud
2 years 1 month ago

Whether the empty relation is reflexive or not depends on the set on which you are defining this relation -- you can define the empty relation on any set A.

The statement "S is reflexive" says: for each x∈A, we have (x,x)∈S. This is vacuously true if A=∅(empty set), and it is false if A is nonempty.

The statement "S is symmetric" says: if (x,y)∈S then (y,x)∈S. This is vacuously true, since (x,y)∉S for all x,y∈A.

The statement "S is transitive" says: if (x,y)∈S and (y,z)∈S then (x,z)∈S. Similarly to the above, this is vacuously true.

To summarize, S is an equivalence relation if and only if it is defined on the empty set. It fails to be reflexive if it is defined on a nonempty set.

moreless
Ranita Biswas
Pritam Prasun
1
Pritam Prasun
905
Ranita Biswas
906
Mahesh Kumar
1017
Manish Singh
1249
Ram Sharma
1723
Parimal Andhalkar
2408
vivek gupta
3911
jayendra
4814
Saurav Das
5366
5493
AYUSHI SINGH
11953
12050
Shivesh Kumar Roy
12578
prash
13422

Pages

11 Jun 2016 - 2:26pm

The approach is absolutely correct. However, there is an error in the calculation. Sum of first n terms is n(n+1)/2 :).

more less
11 Jun 2016 - 2:24pm

Sorry didnt get the time to explain the example suggested. Here it follows:

First push 8  pop 8, push 4 pop 4, push 2 pop 2, push1.
After that push 8 pop 8, push 4 pop 4, push 2.
Again push 8 pop 8, push 4.
Finally push 8.

So, at each step we can see that a pattern is followed and if we relate it with n, then we get 2n-1, 2(n-1)-1, 2(n-2)-1 .... 2(1)-1 respectively. So, adding all these terms, we get
2(n + n-1 + n-2 +......+ 1) - n = 2(n(n+1)/2) - n = n2 + n - n = n2.

more less
9 Jun 2016 - 8:29pm

The maximum possible number of iterations will be n2 which occurs when the numbers are stored in increasing order in Q. It can be proved by taking an example. Take the initial Q as 8,4,2,1. Now execute the given code.

more less
9 Jun 2016 - 10:56am

This program will output 8. The logic is:
first the expression within () is solved. There are three expressions within () separated by comma. The first expression will result in making  a value as 4, the second expression is constant 5 and the third expression is a whose value is now 4.
Now the twist is comma is treated as operator in C, which has left associativity, so the () will return last expression i.e. a with value 4. So, the final expression will be a+=a which results in a value as 8.

more less
8 Jun 2016 - 7:07pm

Whether the empty relation is reflexive or not depends on the set on which you are defining this relation -- you can define the empty relation on any set A.

The statement "S is reflexive" says: for each x∈A, we have (x,x)∈S. This is vacuously true if A=∅(empty set), and it is false if A is nonempty.

The statement "S is symmetric" says: if (x,y)∈S then (y,x)∈S. This is vacuously true, since (x,y)∉S for all x,y∈A.

The statement "S is transitive" says: if (x,y)∈S and (y,z)∈S then (x,z)∈S. Similarly to the above, this is vacuously true.

To summarize, S is an equivalence relation if and only if it is defined on the empty set. It fails to be reflexive if it is defined on a nonempty set.

more less
6 Jun 2016 - 2:52pm

The short-term scheduler (also known as the CPU scheduler) decides which of the ready, in-memory processes are to be executed (allocated a CPU) next following a clock interrupt, an IO interrupt, an operating system call or another form of signal. In practice, the short-term scheduler is invoked whenever an event (internal or external) causes the global state of the system to change. Given that any such change could result in making the runninng process suspended or in making one or more suspended processes ready, the short-term scheduler should be run to determine whether such significant changes have indeed occured and, if so, to select the next process to be run. All of the above mentioned events can cause rescheduling by virtue of their ability to change the global system state, hence OS invokes short-term scheduler in these cases.

more less
3 Jun 2016 - 11:01am

The question is asking for minimum no. of colors that is sufficient to vertex-color any planar graph, i.e. a planar graph with any no. of vertices. However, in some cases, 3 colors are not suffcient to vertex-color a planar graph. But is has been proved that 4 colors are sufficient to vertex-color every planar graph. It is called as the four color theorem. You can have look at the below page:

http://www.mathpages.com/home/kmath266/kmath266.htm

more less
2 Jun 2016 - 12:52pm

your logic for placing digits in forth place is wrong. If you placed 7 in first position then you have 2 choices for forth place(0, 5). But if you placed 5 in first position then u dont have 2 choices for forth place, you can only place 0 there.

more less
2 Jun 2016 - 11:30am

Okay now i got the question, it is given that Y is the inorder-successor of X, which can only be possible if either of the following condition exists:

1). Y is right child of X.
2). Y is parent of X and X does not have right child.

Here condition 1 is in violation of the question, so condition 2 must hold. According to condition 2, X does not have right child is satisfied by the question, so the only thing that is remaining is Y is parent of X. Hence option B is correct.

more less