[algogeeks] Re: bitwise operator confusion

2010-08-09 Thread Avik Mitra
ANSI standard specifies that during right shift of a negative number the shift MUST be a logical shift with sign extension. So, when right shifted will logically with sign extention it gives (in hex). So the answer is [A]. -- You received this message because you are

[algogeeks] Re: bitwise operator confusion

2010-08-09 Thread Avik Mitra
Note that (in hex) is 2's complement representation of -1. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to

[algogeeks] Re: 1's counting

2010-08-09 Thread Avik Mitra
Thanks Dave -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this

[algogeeks] Re: interesting c++ questions

2010-08-09 Thread Avik Mitra
On Aug 3, 8:42 am, Raj N rajn...@gmail.com wrote: 1) Can a constructor call another constructor to initialize the same object? Answer: Yes. 2) Can a struct variable be assigned to another if the structure contains an array as a field? Answer: Yes. 3) Can we pass a private member by

[algogeeks] Re: Default arguments

2010-08-09 Thread Avik Mitra
For a function call that utilizes some other function, yes. A default value to an argument of a function is treated as a local variable of the function. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Re: bitwise operator confusion

2010-08-09 Thread VENKATARAMAN.GB
#includestdio.h int main() { printf(%x\n, (unsigned)-11); return 0; } this will give you the expected result. Cheers, venki VENKATARAMAN.GB If Its Upto Be, It Is Upto Me On Mon, Aug 9, 2010 at 3:53 PM, Avik Mitra tutai...@gmail.com wrote: Note that (in

Re: [algogeeks] Lad Factor

2010-08-09 Thread Abhishek Shrivastav
when loadfactor reaches a specified value, then you have to increase the size of the table which is used for storing the hash values. Otherwise , there would be more collisions if the size is not increased. On Fri, Aug 6, 2010 at 11:11 AM, aparichith vineelyalamar...@gmail.comwrote: Can some

[algogeeks] Array Problem

2010-08-09 Thread amit
Given two sorted positive integer arrays A(n) and B(n), we define a set S = {(a,b) | a \in A and b \in B}. Obviously there are n2 elements in S. The value of such a pair is defined as Val(a,b) = a + b. Now we want to get the n pairs from S with largest values. How to do this in O(nlogn) time. --

Re: [algogeeks] Array Problem

2010-08-09 Thread ankur bhardwaj
we can merge the 2 arrays in sorted manner. Now from the 2nd last number,we can have the first pair (last,second last).From the 3rd last,we can have 2 pairs (last,3rd last) and (2nd last,3rd last). similarly we will keep on taking till we get n pairs. time complexity: O(2n+n)- O(n) space

Re: [algogeeks] Array Problem

2010-08-09 Thread Chonku
Since the arrays are sorted, you should be able to do this in O(n) time. a[1..n], b[1..n] output a[n], b[n] int count=1; while (i 0 and j 0 and count n) Begin if (a[i-1] * b[j] = a[i] * b[j-1]) Begin Output a[i-1] b[j] i=i-1; End else Begin

[algogeeks] Microsoft Question

2010-08-09 Thread amit
Given a text file, implement a solution to find out if a pattern similar to wild cards can be detected. fort example find if a*b*cd*, or *win or *def* exists in the text. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

Re: [algogeeks] Microsoft Question

2010-08-09 Thread sharad kumar
nice onefor searching first u need to build the suffix tree for each letter with * once u do it perform a search in other word u need to implement grep command rite?? On Mon, Aug 9, 2010 at 7:00 PM, amit amitjaspal...@gmail.com wrote: Given a text file, implement a solution to find out if a

Re: [algogeeks] Array Problem

2010-08-09 Thread ankur bhardwaj
ignore my last post :( -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options,

Re: [algogeeks] Doubly linklist to Singly linklist...........

2010-08-09 Thread Ashish Goel
An XOR linked list compresses the same information into *one* address field by storing the bitwise XOR of the address for *previous* and the address for *next* in one field: ... AB C D E ... – A⊕C - B⊕D - C⊕E - When you traverse the list from

[algogeeks] Re: Microsoft Question

2010-08-09 Thread Gene
This is pretty standard stuff. Look up finite automaton. On Aug 9, 9:30 am, amit amitjaspal...@gmail.com wrote: Given a text file, implement a solution to find out if a pattern similar to wild cards can be detected. fort example find if a*b*cd*, or *win or *def* exists in the text. -- You