[algogeeks] Singly to doubly....

2010-08-09 Thread UMESH KUMAR
How to convert Singly link list to Doubly link list without converting
the Structure of the list ,so possible or not if possible then explain
soon.

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



[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  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 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 group at 
http://groups.google.com/group/algogeeks?hl=en.



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 left to right: supposing you are at C, you
can take the address of the previous item, B, and XOR it with the value in
the link field (B⊕D). You will then have the address for D and you can
continue traversing the list. The same pattern applies in the other
direction.



Question: since the address of B is not stored explicitly in C, the
statement "you can take address of previous item B and xor it in the link
field" is not clear. i understand that there are no previous or next links
after having the XOR values per node. Afterall the objective is to reduce
storage here..





Best Regards
Ashish Goel
"Think positive and find fuel in failure"
+919985813081
+919966006652


On Sun, Aug 8, 2010 at 12:19 PM, Pramod Negi  wrote:

> Search XoR List on Wiki
>
>
> On Sun, Aug 8, 2010 at 10:19 AM, UMESH KUMAR wrote:
>
>> how to convert Doubly Link list to a Singly link list without changes
>> the Structure of the list if possible or not ,if possible then try to
>> discus of that problem.
>>
>>
>> thanks and Regards
>> Umesh kumar
>>
>>  --
>> 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 group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] DLL to B-tree

2010-08-09 Thread amit
Given a pointer to the node, the node has one data part and two
address pointers of its own type,
If the node represent a doubly linked list convert it to B-Tree and
vice versa.

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



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  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 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



[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, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



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
Output a[i] & b[j-1]
 j = j-1;
  End
 ++count;
End

On Mon, Aug 9, 2010 at 6:36 PM, amit  wrote:

> 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.
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



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 complexity: O(2n)->O(n)

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



[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.

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: bitwise operator confusion

2010-08-09 Thread Mihai Donțu
On Monday 09 August 2010 13:22:20 Avik Mitra wrote:
> 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].

Dave is right. Quoting from C99 (the _current_ ANSI C standard): "The result 
of E1 >> E2 is E1 right-shifted E2 bit positions. If E1 has an unsigned type
or if E1 has a signed type and a nonnegative value, the value of the result is 
the integral part of the quotient of E1 / 2^E2 . If E1 has a signed type and a 
negative value, the resulting value is implementation-defined."

-- 
Mihai Donțu

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



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 wrote:

> Can some one explain me  the significance of Load Factor in Hashing ?
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: bitwise operator confusion

2010-08-09 Thread VENKATARAMAN.GB
#include

int main()
{
   printf("%x\n", (unsigned)-1>>1);
   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  wrote:

>
> 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+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



[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 algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: interesting c++ questions

2010-08-09 Thread Avik Mitra


On Aug 3, 8:42 am, Raj N  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 reference to a non member function?
Answer: Maybe possible in case of friend function.

> 4) Can the destructor be called explicitly?
> 5) Can copy constructor be the default constructor of a class?

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



[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 group at 
http://groups.google.com/group/algogeeks?hl=en.



[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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[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 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 group at 
http://groups.google.com/group/algogeeks?hl=en.