Ranita works as an Assistant Professor at the Computer Science and Engineering Department at IIT Roorkee. She has completed her PhD from the Computer Science and Engineering Department at IIT Kharagpur. Before that, she has done her MTech from IIEST Shibpur, and got job offers from companies like Amazon, Samsung Labs etc. However, she preferred to pursue higher studies to stay in the field of academics and teaching. She believes in the motto of free education and contribution.


Alma Mater:

IIT Kharagpur
2012 to 2016
Master of Engineering
Indian Institute of Engineering Science and Technology, Shibpur
2010 to 2012
Bachelor of Technology
Kalyani Government Engineering College
2005 to 2009


Assistant Professor
Indian Institute of Technology Roorkee
Project Linked Personnel
Indian Statistical Institute, Kolkata
2009 to 2010
7 months 1 week ago

The correct answer is (b) remains same. To understand this, let us revise the informal algorithm for Timestamp based protocol for concurrency control (copied from Wikipedia, you can also refer to the formal version of the algorithm there):

1) If a transaction wants to read an object,

a) but the transaction started before the object's write timestamp it means that something changed the object's data after the transaction started. In this case, the transaction is canceled and must be restarted.
b) and the transaction started after the object's write timestamp, it means that it is safe to read the object. In this case, if the transaction timestamp is after the object's read timestamp, the read timestamp is set to the transaction timestamp.
2) If a transaction wants to write to an object,

a) but the transaction started before the object's read timestamp it means that something has had a look at the object, and we assume it took a copy of the object's data. So we can't write to the object as that would make any copied data invalid, so the transaction is aborted and must be restarted.
b) and the transaction started before the object's write timestamp it means that something has changed the object since we started our transaction. In this case, we use the Thomas write rule and simply skip our write operation and continue as normal; the transaction does not have to be aborted or restarted
c) otherwise, the transaction writes to the object, and the object's write timestamp is set to the transaction's timestamp.

Now consider the following example schedule:

T1      T2      T3      T4

Consider that after the execution of the last R(A), T4 needs to rollback (as given in the question). So, RTS(A) was 4 and now we need to decide what should be the new RTS for A. Note that, the schedule at hand now is something like the following:

T1      T2      T3

Independent of T4, this schedule will have RTS(A) = 3 when T2 tries to write and hence T2 should be aborted by rule 2(a).

Now, after rollback of T4, consider option (a) i.e. changing the RTS(A) to 0. This will certainly allow W(A) by T2 to execute without any problem as it falls under rule 2(c) and hence violates concurrency by allowing T2 to write a data already read by T3.

Consider option (c) i.e. RTS(A) becomes equal to the timestamp of the transaction which read 'A' just before T4, in this example then RTS(A) becomes 1. And hence the same problem arises as choosing option (a).

Therefore, if we choose option (b) and keep the RTS(A) same as before i.e. 4, then W(A) by T2 will fall under rule 2(a) and hence will be aborted. So, option (b) is the correct answer.

This is why RTS is kept as the largest of the timestamps of the transactions which has read the data, and not the recent timestamp.

Example text
8 months 3 weeks ago

This is an example of fan trap and chasm trap and how to resolve these scenarios. The following brief explanation may help you in understanding the concept which is usually found to be dubious across the web. This explanation is made in parity with the concept explained in Wikipedia (https://en.wikipedia.org/wiki/Entity–relationship_model#Model_usability_issues). You can also refer to https://db.grussell.org/section005.html to understand in detail.

Example text
10 months 1 week ago

You are very close to the answer. But, there is one catch; the first row of pixels (at y = 0) and the last row of pixels (at y = 37) are not full length. You may try to modify the approach accordingly to get to the correct answer. Very good presentation, by the way.

Example text
10 months 2 weeks ago

Consider the attribute set ABCDEG and the FD set
AB → C, AC → B, AD → E, B → D, BC → A, E → G
Is the following decomposition of R(ABCDEG)
(a) dependency-preserving?
(b) lossless-join?
Give proper justification for your answer.

jayantachakr's picture
Jayanta Chakraborty
innovwelt's picture
arvind.rawat's picture
Arvind Rawat
pritam's picture
Pritam Prasun
techtud's picture
Techtud Admin
pritam's picture
Pritam Prasun
vivek14's picture
Vivek Vikram Singh
pashupati's picture
Pashupati Jha
priyesh's picture
Priyesh Priyatam
girraj's picture
shreyans's picture
Shreyans Dhankhar
ribhu122's picture
Ribhu Ranjan
prafull's picture
Prafull Ranjan
antonio's picture
Antonio Anastasio Bruto da Costa
shabinmuhammed's picture
Shabin Muhammed
shuvankarchakraborty's picture


You cannot choose a 'nearest' answer from all wrong choices. In case of a question like this, everyone should get full marks.

more less

Selection sort uses brute force strategy. Initial assumption may be Greedy, but it is not true; because selection sort goes through all the remaining elements in each iteration and chooses the minimum, it does not locally optimize the output.

Go through this link: http://faculty.simpson.edu/lydia.sinapova/www/cmsc250/LN250_Weiss/L28-De...

more less
6 Jun 2016 - 5:29pm

B is NP-Hard and B is in NP implies B is NP-complete.
B < A tells us that A is NP-hard.
Now, we still don't know A is in NP or not.
A < B tells us we can polynomial time reduce A to a problem in NP, so A is also in NP.
Therefore, A is NP-complete.
We get, (b) A is NP-Complete as well as NP-Hard.

more less
6 Jun 2016 - 10:37am

I got it now. Thanks for clarifying.

more less
5 Jun 2016 - 10:32am

The first statement says that "There exists infinite sets A, B, C ..."
You have only shown that "There exists sets A, B, C ..." by finding one example.
Please solve how to tackle the 'infinite' part of the proof.

more less
5 Jun 2016 - 10:25am

Reflexive closure is a superset of the original relation so that it is reflexive (i.e. contains elements of the form (x, x)) as well as contains all elements of the original relation. d=1 ensures that all elements of the form (x, x+1) are included in the relation; whereas d=0 ensures that all elements of the form (x, x) are also included in the relation which essentially makes it a reflexive relation. Let's take a small example: Reflexive closure of the relation S = {(1, 2), (2, 3)} is R = {(1, 1), (1, 2), (2, 2), (2, 3), (3, 3)}. Please let me know if it is still not clear.

more less
4 Jun 2016 - 7:06pm

I have tried to make the figure as self-explanatory as possible. The path of the packet is shown in orange line. Each visit to Network layer has been numbered in blue and each visit to Datalink layer has been numbered in red. So, total number of times each packet visits the Network layer is 4 and the Datalink layer is 6.

more less
4 Jun 2016 - 6:35pm

The reflexive transitive closure of a relation S is defined as the smallest superset of S which is a reflexive and transitive relation. Now, given S contains elements like (x, x+1). So, its reflexive closure should contain elements like (x, x) also. The reflexive closure can be given as:
{(x, x+d) | d ∈ {0, 1} and x ∈ {0, 1, 2, … }}.
Now, in transitive closure, we know that if (x, y) and (y, z) belong to the relation then (x, z) should also belong to the relation. So, if (x, y) = (x, x+1) and (y, z) = (y, y+1) then (x, z) = (x, x+2) must also belong to the transitive closure. In a similar way, you can argue that (x, x+d) for any d ≥ 1 will belong to the transitive closure. So, the transitive closure can be given as:
{(x, x+d) | d ∈ {1, 2, ... } and x ∈ {0, 1, 2, … }}.
Therefore, we get the reflexive transitive closure as:
{(x, x+d) | d ∈ {0, 1, 2, ... } and x ∈ {0, 1, 2, … }}, which can also be written as:
{(x, y) | y ≥ x and x, y ∈ {0, 1, 2, … }}.
That is option (B) is the correct answer.

more less

T(n) & = \dfrac{1}{\lg n}+\dfrac{1}{\lg (n-2)}+\dfrac{1}{\lg (n-4)}+\dots \\
& = \sum\limits_{0}^{\tfrac{n}{2}-1} \dfrac{1}{ \lg(n-2i) } \\
& = \dfrac{1}{\lg 2}+\dfrac{1}{\lg 4}+\dfrac{1}{\lg 6}+\dfrac{1}{\lg 8}+\dots +\dfrac{1}{\lg n}\;\;\;\mbox{(in reverse direction)}\\
& = 1+\dfrac{1}{2}+\dfrac{1}{\lg 6}+\dfrac{1}{3}+\dots +\dfrac{1}{a}\;\;\;\mbox{(where, $a=\lg n$)}\\
& = O\left( \int\limits_{x=1}^{a}\dfrac{1}{x}dx\right)\\
& = O\left([\lg x]_1^a\right)\\
& = O\left(\lg a - \lg 1\right)\\
& = O\left(\lg \lg n\right)

more less
30 May 2016 - 9:06pm

Take two examples,
n = 4:
Comparisons made are: 1<=4 (true), 2<=4 (true), 4<=4 (true), 8<=4 (false and hence end of loop).
n = 5:
Comparisons made are: 1<=5 (true), 2<=5 (true), 4<=5 (true), 8<=5 (false and hence end of loop).
Therefore, you can conclude that the total number of comparisons made in the execution of the loop for any n > 0 is : floor(log2n) + 2
So, none of the options matches.

more less