Search Results

Search found 3 results on 1 pages for 'cupidvogel'.

Page 1/1 | 1 

  • New record may be written twice in clusterd index structure

    - by Cupidvogel
    As per the article at Microsoft, under the Test 1: INSERT Performance section, it is written that For the table with the clustered index, only a single write operation is required since the leaf nodes of the clustered index are data pages (as explained in the section Clustered Indexes and Heaps), whereas for the table with the nonclustered index, two write operations are required—one for the entry into the index B-tree and another for the insert of the data itself. I don't think that is necessarily true. Clustered Indexes are implemented through B+ tree structures, right? If you look at at this article, which gives a simple example of inserting into a B+ tree, we can see that when 8 is initially inserted, it is written only once, but then when 5 comes in, it is written to the root node as well (thus written twice, albeit not initially at the time of insertion). Also when 8 comes in next, it is written twice, once at the root and then at the leaf. So won't it be correct to say, that the number of rewrites in case of a clustered index is much less compared to a NIC structure (where it must occur every time), instead of saying that rewrite doesn't occur in CI at all?

    Read the article

  • Any better algorithm possible here?

    - by Cupidvogel
    I am trying to solve this problem in Python. Noting that only the first kiss requires the alternation, any kiss that is not a part of the chain due to the first kiss can very well have a hug on the 2nd next person, this is the code I have come up with. This is just a simple mathematical calculation, no looping, no iteration, nothing. But still I am getting a timed-out message. Any means to optimize it? import psyco psyco.full() testcase = int(raw_input()) for i in xrange(0,testcase): n = int(raw_input()) if n%2: m = n/2; ans = 2 + 4*(2**m-1); ans = ans%1000000007; print ans else: m = n/2 - 1 ans = 2 + 2**(n/2) + 4*(2**m-1); ans = ans%1000000007 print ans

    Read the article

  • How to invert alternate bits of a number

    - by Cupidvogel
    The problem is how to invert alternate bits of a number, starting from the LSB. Currently what I am doing is first doing a count = -1 while n: n >>= 1 count += 1 to first find the position of the leftmost set bit, then running a loop to invert every alternate bit: i = 0 while i <= count: num ^= 1<<i i += 2 Is there a quick hack solution instead of this rather boring loop solution? Of course, the solution can't make any asumption about the size of the integer.

    Read the article

1