[algogeeks] Pattern Matching

2011-09-02 Thread Abhishek Yadav
Implement a function that receive a string S and a pattern containing
wild characters ( * and ? only) in string P. Function return true if S
matches the pattern P.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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: Closest ancestor of two nodes

2011-09-02 Thread Abhishek Yadav
this solution works if parent pointer is given.
1. Start moving up from both the nodes (if two nodes become equal, fine this
is the common ancestor) till you reach the root node and in between count
the number of nodes you covered in their path for both the nodes. Say 7 for
node A and 10 for node B.
2. Now from B (longer path node) move up 3 (10-7) nodes.
3. now start moving up from B's new position and from A. Wherever they meet
is the common ancestor.

On Sat, Sep 3, 2011 at 11:13 AM, bharatkumar bagana <
bagana.bharatku...@gmail.com> wrote:

> For BST it is easy ...it can be find in O(logn) time ..
> when ever we find that the direction we are searching for x and y are
> different, that node is the common ancestor ...no need to find either x or y
> where the nodes are...
> what about binary tree ? how do we search an element in binary tree
> efficiently ?
>
>
> On Sat, Sep 3, 2011 at 12:44 AM, rajul jain wrote:
>
>> @anika this solution only works for BST
>>
>> On Mon, Aug 15, 2011 at 4:20 PM, Anika Jain wrote:
>>
>>> node *common_ancestor(node *root, node **prev, int x,int y)
>>> {
>>> if(root->a==x || root->a==y)
>>> return *prev;
>>> else if(root->a > x && root->a > y)
>>> {
>>> prev=&root;
>>> return common_ancestor(root->l,prev, x,y);
>>> }
>>> else if(root->a < x && root->a < y)
>>> {
>>> prev=&root;
>>> return common_ancestor(root->r,prev, x,y);
>>> }
>>> else
>>> {
>>> prev=&root;
>>> return *prev;
>>> }
>>> }
>>>
>>> with call as
>>> node *prev=NULL;
>>>  common_ancestor(root,&prev,x,y);
>>>
>>>
>>> On Sun, Aug 14, 2011 at 10:08 PM, Yasir  wrote:
>>>
 Guys, How about the below mentioned implementation?
 The only assumptions is that nodes should exist  in the tree. (will fail
 if one node exists and another doesn't)

 static Node LCA(Node root, int d1, int d2){
  if(root==null)
 return root;
  if(root.left!=null && ( root.left.data == d1 || root.left.data==d2 ) )
  // both nodes exists in left sub-tree
 return root;

 if(root.right!=null && ( root.right.data == d1 || root.right.data==d2) )
   // both nodes exists in right sub-tree
 return root;
  Node ltree = LCA(root.left, d1, d2);   //check recursively in left
 subtree
 Node rtree = LCA(root.right, d1, d2);// check recursively in
 right subtree
  if(ltree!=null && rtree!=null)// One node in left & another in
 right
 return root;
  return (ltree==null)?rtree:ltree;
 }


 Just to mention that, closest ancestor of 5&4 OR 4&9 would be 3 in the
 following tree:
  3
\
4
  /\
 5 8
   /
 9

 --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/24JUUQsBHvIJ.

 To post to this group, send email to algogeeks@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 algogeeks@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 algogeeks@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.
>>
>
>
>
> --
>
> **Please do not print this e-mail until urgent requirement. Go Green!!
> Save Papers <=> Save Trees
> *BharatKumar Bagana*
> **http://www.google.com/profiles/bagana.bharatkumar
> *
> Mobile +91 8056127652*
> 
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googl

Re: [algogeeks] Re: Closest ancestor of two nodes

2011-09-02 Thread bharatkumar bagana
For BST it is easy ...it can be find in O(logn) time ..
when ever we find that the direction we are searching for x and y are
different, that node is the common ancestor ...no need to find either x or y
where the nodes are...
what about binary tree ? how do we search an element in binary tree
efficiently ?

On Sat, Sep 3, 2011 at 12:44 AM, rajul jain  wrote:

> @anika this solution only works for BST
>
> On Mon, Aug 15, 2011 at 4:20 PM, Anika Jain wrote:
>
>> node *common_ancestor(node *root, node **prev, int x,int y)
>> {
>> if(root->a==x || root->a==y)
>> return *prev;
>> else if(root->a > x && root->a > y)
>> {
>> prev=&root;
>> return common_ancestor(root->l,prev, x,y);
>> }
>> else if(root->a < x && root->a < y)
>> {
>> prev=&root;
>> return common_ancestor(root->r,prev, x,y);
>> }
>> else
>> {
>> prev=&root;
>> return *prev;
>> }
>> }
>>
>> with call as
>> node *prev=NULL;
>>  common_ancestor(root,&prev,x,y);
>>
>>
>> On Sun, Aug 14, 2011 at 10:08 PM, Yasir  wrote:
>>
>>> Guys, How about the below mentioned implementation?
>>> The only assumptions is that nodes should exist  in the tree. (will fail
>>> if one node exists and another doesn't)
>>>
>>> static Node LCA(Node root, int d1, int d2){
>>>  if(root==null)
>>> return root;
>>>  if(root.left!=null && ( root.left.data == d1 || root.left.data==d2 ) )
>>>  // both nodes exists in left sub-tree
>>> return root;
>>>
>>> if(root.right!=null && ( root.right.data == d1 || root.right.data==d2) )
>>>   // both nodes exists in right sub-tree
>>> return root;
>>>  Node ltree = LCA(root.left, d1, d2);   //check recursively in left
>>> subtree
>>> Node rtree = LCA(root.right, d1, d2);// check recursively in
>>> right subtree
>>>  if(ltree!=null && rtree!=null)// One node in left & another in
>>> right
>>> return root;
>>>  return (ltree==null)?rtree:ltree;
>>> }
>>>
>>>
>>> Just to mention that, closest ancestor of 5&4 OR 4&9 would be 3 in the
>>> following tree:
>>>  3
>>>\
>>>4
>>>  /\
>>> 5 8
>>>   /
>>> 9
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msg/algogeeks/-/24JUUQsBHvIJ.
>>>
>>> To post to this group, send email to algogeeks@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 algogeeks@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 algogeeks@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.
>



-- 

**Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers <=> Save Trees
*BharatKumar Bagana*
**http://www.google.com/profiles/bagana.bharatkumar
*
Mobile +91 8056127652*


-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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: Find Max Sum Value Pairs

2011-09-02 Thread Piyush Grover
Since A(n) and B(n) are sorted so in the pair (a[i], b[j]) either i = n-1 or
j = n-1 or both.
1.) so the first element is (a[n-1], b[n-1])

2.) now, we have two numbers to compare p = a[n-1]+ b[n-2]  and q =
a[n-2]+b[n-1]

3.) if p>q then p = a[n-1]+b[n-3]
else q = a[n-3] + b[n-1]
and repeat in the similar fashion

The point to note is, either a's index is n-1 or b's index is n-1.

On Sat, Sep 3, 2011 at 10:18 AM, Siddhartha Banerjee <
thefourrup...@gmail.com> wrote:

> yeah piyush's solution seems correct to me... if current amx is from
> a[i],b[j], then next maximum can only be either of a[i-1],b[j] or
> a[i],b[j-1] continue!!!
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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 algogeeks@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: Network Question

2011-09-02 Thread bharatkumar bagana
I didn't understand "so subnet 10.0.1.0/26 cannot communicate with
10.0.1.0/24
having same ip node more over packet sent within 10.0.1.0/24 will
reach 10.0.1.0/26 not to the nodes on the same network .. so
10.0.1.0/24 can communicate with 10.0.1.0/26
but cannot communicate within itself .."

what do u mean?
In a n/w all the IP 's should be unique ? can there exist like this .. pls
explain me detail y ...

On Sat, Sep 3, 2011 at 1:09 AM, Vengadanathan wrote:

> ya both the subnet can exisit in the same network , but problem is
> lack of communication between the two subnets ,because in routing
> table of the router the record for  10.0.1.0/26 will be first then
> record for 10.0.1.0/24 will be , so 10.0.1.0/26 will be given first
> preference , so subnet 10.0.1.0/26 cannot communicate with 10.0.1.0/24
> having same ip node more over packet sent within 10.0.1.0/24 will
> reach 10.0.1.0/26 not to the nodes on the same network .. so
> 10.0.1.0/24 can communicate with 10.0.1.0/26
> but cannot communicate within itself ..
>
> On Sep 3, 9:38 am, bharatkumar bagana 
> wrote:
> > all the addresses which come under second addr will also come under first
> > 
> > Can those 2 be exist in same LAN ?
> > If yes , how can router decides to which subnet it has to pass through
> the
> > incoming packet ..
> >
> > On Fri, Sep 2, 2011 at 6:36 PM, aditya kumar
> > wrote:
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > > their wont be any conflict in ip address . coz within dhcp assigns ip
> > > adsress from the pool of available address and within the n/w (LAN) we
> need
> > > to have unique ip address bt across the n/w (LAN) we can use same ip
> from
> > > the pool of ip addresses .
> >
> > > On Sat, Sep 3, 2011 at 1:56 AM, sagar pareek  >wrote:
> >
> > >> It is urgent to get the answer thats why i m posting network question
> > >> here... searching on net is not working
> >
> > >>  HI !!
> > >> I stuck on a question related to VLSM
> >
> > >> Suppose we have two subnets as
> >
> > >> 10.0.1.0/24   valid ip address can be 10.0.1.2
> >
> > >> and
> >
> > >> 10.0.1.0/26 here also valid ip address can be 10.0.1.2
> >
> > >> now suppose we are using these two subnets in a LAN and having this ip
> > >> (10.0.1.2) in both the subnets then is there any IP conflict will
> happen or
> > >> not?
> >
> > >> --
> > >> **Regards
> > >> SAGAR PAREEK
> > >> COMPUTER SCIENCE AND ENGINEERING
> > >> NIT ALLAHABAD
> >
> > >>  --
> > >> You received this message because you are subscribed to the Google
> Groups
> > >> "Algorithm Geeks" group.
> > >> To post to this group, send email to algogeeks@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 algogeeks@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.
> >
> > --
> >
> > **Please do not print this e-mail until urgent requirement. Go Green!!
> > Save Papers <=> Save Trees
> > *BharatKumar Bagana*
> > **http://www.google.com/profiles/bagana.bharatkumar<
> http://www.google.com/profiles/bagana.bharatkumar>
> > *
> > Mobile +91 8056127652*
> > 
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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.
>
>


-- 

**Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers <=> Save Trees
*BharatKumar Bagana*
**http://www.google.com/profiles/bagana.bharatkumar
*
Mobile +91 8056127652*


-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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] Hash Table ( A hashtable class in c++)

2011-09-02 Thread Aj G
#include
#include
#include
#include
using namespace std;


// It is not advisable to list all elements in this hash table.
#define HASH_SIZE 51439
class HashTable
{
public:
  vector< map > table;

  HashTable()
  {
table = vector< map >(HASH_SIZE);
  }

  int hashF(long long key)
  {
if( key < 0)
  {
key = key + HASH_SIZE*( abs(key)/HASH_SIZE + 1);
  }
return  key%HASH_SIZE;
  }

  pair< map::iterator, bool > insert(long long key, int
value)
  {
int index = hashF(key);
return table[index].insert(pair(key,value));
  }

  int getCount(long long key)
  {
int index = hashF(key);
int count = table[index].count(key);

return count;
  }

  int getValue(long long key)
  {
int index = hashF(key);
return table[index][key];
  }

};


On Sat, Sep 3, 2011 at 10:44 AM, Rahul Verma wrote:

> I am facing some difficulty in the implementation of Hash Table. Anyone can
> please share the good resources for Hash Table?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/DmcDxyNXfwEJ.
> To post to this group, send email to algogeeks@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 algogeeks@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] Hash Table

2011-09-02 Thread Rahul Verma
I am facing some difficulty in the implementation of Hash Table. Anyone can 
please share the good resources for Hash Table?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/DmcDxyNXfwEJ.
To post to this group, send email to algogeeks@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: Network Question

2011-09-02 Thread Vengadanathan
ya both the subnet can exisit in the same network , but problem is
lack of communication between the two subnets ,because in routing
table of the router the record for  10.0.1.0/26 will be first then
record for 10.0.1.0/24 will be , so 10.0.1.0/26 will be given first
preference , so subnet 10.0.1.0/26 cannot communicate with 10.0.1.0/24
having same ip node more over packet sent within 10.0.1.0/24 will
reach 10.0.1.0/26 not to the nodes on the same network .. so
10.0.1.0/24 can communicate with 10.0.1.0/26
but cannot communicate within itself ..

On Sep 3, 9:38 am, bharatkumar bagana 
wrote:
> all the addresses which come under second addr will also come under first
> 
> Can those 2 be exist in same LAN ?
> If yes , how can router decides to which subnet it has to pass through the
> incoming packet ..
>
> On Fri, Sep 2, 2011 at 6:36 PM, aditya kumar
> wrote:
>
>
>
>
>
>
>
>
>
> > their wont be any conflict in ip address . coz within dhcp assigns ip
> > adsress from the pool of available address and within the n/w (LAN) we need
> > to have unique ip address bt across the n/w (LAN) we can use same ip from
> > the pool of ip addresses .
>
> > On Sat, Sep 3, 2011 at 1:56 AM, sagar pareek wrote:
>
> >> It is urgent to get the answer thats why i m posting network question
> >> here... searching on net is not working
>
> >>  HI !!
> >> I stuck on a question related to VLSM
>
> >> Suppose we have two subnets as
>
> >> 10.0.1.0/24   valid ip address can be 10.0.1.2
>
> >> and
>
> >> 10.0.1.0/26 here also valid ip address can be 10.0.1.2
>
> >> now suppose we are using these two subnets in a LAN and having this ip
> >> (10.0.1.2) in both the subnets then is there any IP conflict will happen or
> >> not?
>
> >> --
> >> **Regards
> >> SAGAR PAREEK
> >> COMPUTER SCIENCE AND ENGINEERING
> >> NIT ALLAHABAD
>
> >>  --
> >> You received this message because you are subscribed to the Google Groups
> >> "Algorithm Geeks" group.
> >> To post to this group, send email to algogeeks@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 algogeeks@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.
>
> --
>
> **Please do not print this e-mail until urgent requirement. Go Green!!
> Save Papers <=> Save Trees
> *BharatKumar Bagana*
> **http://www.google.com/profiles/bagana.bharatkumar
> *
> Mobile +91 8056127652*
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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: Find Max Sum Value Pairs

2011-09-02 Thread Siddhartha Banerjee
yeah piyush's solution seems correct to me... if current amx is from
a[i],b[j], then next maximum can only be either of a[i-1],b[j] or
a[i],b[j-1] continue!!!

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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: subarray wid sum=k

2011-09-02 Thread bharatkumar bagana
ya , it can start from middle ...but continuous right ..

On Fri, Sep 2, 2011 at 4:34 PM, WgpShashank wrote:

> Yes Neha, I Never Said That SubArray has to be Started from 0th index,else
> What Will be the advantage of this saying subarray anyways, here O(N) time &
> O(N) space solution
>
>int prefix_sum = 0;
>   hash_map find_subarray;
>   int start_index = -1, end_index = -1;
>   for (int i = 0,;i < n; ++i)
>   {
>
> if (a[i]==k)
> {
>start_index = i;
>end_index = i;
>break;
> }
>   prefix_sum += a[i];
>
>   if (prefix_sum==k)
>  {
> start_index = 0;
> end_index = i;
> break;
> }
>
> if (find_subarray.find(prefix_sum) == k)
> {
> find_subarray[prefix_sum] = i;
> }
> else
> {
> start_index = find_subarray[prefix_sum] + 1;
> end_index = i;
> break;
> }
>   }
>
>   if (start_index != -1)
>   {
> cout << "Zero sum subarray found. Start index : " << start_index
>  << ". End Index: " << end_index << "\n";
>   }
>
>
> -2 1 -2 5 -1 4 -6 -7 k=9 subarray will be -2 5-1 4 -6
>
> @all Whats Say ?
>
>
>
>
>
> Shashank Mani
> Computer Science
> Birla Institute of Technology,Mesra
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/SNpbdnf1PTMJ.
>
> To post to this group, send email to algogeeks@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.
>



-- 

**Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers <=> Save Trees
*BharatKumar Bagana*
**http://www.google.com/profiles/bagana.bharatkumar
*
Mobile +91 8056127652*


-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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: Closest ancestor of two nodes

2011-09-02 Thread rajul jain
@anika this solution only works for BST

On Mon, Aug 15, 2011 at 4:20 PM, Anika Jain  wrote:

> node *common_ancestor(node *root, node **prev, int x,int y)
> {
> if(root->a==x || root->a==y)
> return *prev;
> else if(root->a > x && root->a > y)
> {
> prev=&root;
> return common_ancestor(root->l,prev, x,y);
> }
> else if(root->a < x && root->a < y)
> {
> prev=&root;
> return common_ancestor(root->r,prev, x,y);
> }
> else
> {
> prev=&root;
> return *prev;
> }
> }
>
> with call as
> node *prev=NULL;
>  common_ancestor(root,&prev,x,y);
>
>
> On Sun, Aug 14, 2011 at 10:08 PM, Yasir  wrote:
>
>> Guys, How about the below mentioned implementation?
>> The only assumptions is that nodes should exist  in the tree. (will fail
>> if one node exists and another doesn't)
>>
>> static Node LCA(Node root, int d1, int d2){
>>  if(root==null)
>> return root;
>>  if(root.left!=null && ( root.left.data == d1 || root.left.data==d2 ) )
>>// both nodes exists in left sub-tree
>> return root;
>>
>> if(root.right!=null && ( root.right.data == d1 || root.right.data==d2) )
>>   // both nodes exists in right sub-tree
>> return root;
>>  Node ltree = LCA(root.left, d1, d2);   //check recursively in left
>> subtree
>> Node rtree = LCA(root.right, d1, d2);// check recursively in
>> right subtree
>>  if(ltree!=null && rtree!=null)// One node in left & another in right
>> return root;
>>  return (ltree==null)?rtree:ltree;
>> }
>>
>>
>> Just to mention that, closest ancestor of 5&4 OR 4&9 would be 3 in the
>> following tree:
>>  3
>>\
>>4
>>  /\
>> 5 8
>>   /
>> 9
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/algogeeks/-/24JUUQsBHvIJ.
>>
>> To post to this group, send email to algogeeks@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 algogeeks@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 algogeeks@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] pattern matching

2011-09-02 Thread bharatkumar bagana
wht is KMP? pls give some info ..

On Fri, Sep 2, 2011 at 11:59 PM, sukran dhawan wrote:

> start drom brue force.then interviewer will ask u to optimize it.then
> refine it.dont jum into the optimised soln directly
>
> On Sat, Sep 3, 2011 at 12:35 AM, Aman Kumar  wrote:
>
>> Hiii
>>
>> Friends ,if pattern matching question is asked in the interview , we
>> should answer brute force(with some optimization) approach or use
>> ADVANCED algorithm like KMP?
>>
>> I am very much confused regarding this because in on blog i have read
>> that we should not use advanced data structure in interview.
>>
>>
>> help me out.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@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 algogeeks@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.
>



-- 

**Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers <=> Save Trees
*BharatKumar Bagana*
**http://www.google.com/profiles/bagana.bharatkumar
*
Mobile +91 8056127652*


-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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] Network Question

2011-09-02 Thread bharatkumar bagana
all the addresses which come under second addr will also come under first

Can those 2 be exist in same LAN ?
If yes , how can router decides to which subnet it has to pass through the
incoming packet ..

On Fri, Sep 2, 2011 at 6:36 PM, aditya kumar
wrote:

> their wont be any conflict in ip address . coz within dhcp assigns ip
> adsress from the pool of available address and within the n/w (LAN) we need
> to have unique ip address bt across the n/w (LAN) we can use same ip from
> the pool of ip addresses .
>
>
> On Sat, Sep 3, 2011 at 1:56 AM, sagar pareek wrote:
>
>> It is urgent to get the answer thats why i m posting network question
>> here... searching on net is not working
>>
>>  HI !!
>> I stuck on a question related to VLSM
>>
>> Suppose we have two subnets as
>>
>> 10.0.1.0/24   valid ip address can be 10.0.1.2
>>
>> and
>>
>> 10.0.1.0/26 here also valid ip address can be 10.0.1.2
>>
>> now suppose we are using these two subnets in a LAN and having this ip
>> (10.0.1.2) in both the subnets then is there any IP conflict will happen or
>> not?
>>
>> --
>> **Regards
>> SAGAR PAREEK
>> COMPUTER SCIENCE AND ENGINEERING
>> NIT ALLAHABAD
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@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 algogeeks@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.
>



-- 

**Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers <=> Save Trees
*BharatKumar Bagana*
**http://www.google.com/profiles/bagana.bharatkumar
*
Mobile +91 8056127652*


-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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: Need algorithm asap

2011-09-02 Thread Siddhartha Banerjee
no of valid bipartitions are 2^n, thats what he meant I guess... ( if you do
not want null set as one of the partitions then subtract 1 from answer...)

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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: Find Max Sum Value Pairs

2011-09-02 Thread bharatkumar bagana
@pitush: pls explain your logic once 

On Fri, Sep 2, 2011 at 4:09 PM, Piyush Grover wrote:

> if I have understood the question correctly then:
>
> a[n-1] + b[i] > a[j] + b[i] for all 0 <= j <  n-1
> and a[j] + b[n-1] > a[j] + b[i] for all 0 <= i < n-1
> therefore,
>
> i = j =n-1;
> count = 1;
> S[0] <-- (a[n-1], b[n-1])
> p = a[n-1] + b[n-2];
> q = a[n-2] + b[n-1]
>
> while(count < n){
>
> if(p > q){
>  j--;
>  S[count++] <-- (a[n-1], b[j]);
> }else{
> i--;
> S[count++]  <-- (a[i], b[n-1]);
> }
>
> p = a[n-1] + b[j-1];
> q = a[i-1] + b[n-1];
>
> }
> Time complexity: O(n)  :  http://ideone.com/FXfVj
>
>
>
> On Fri, Sep 2, 2011 at 10:05 PM, WgpShashank 
> wrote:
>
>> @Dave Correct , Missed to Provide the Correct Time Complexity in Worst
>> Case it Will be O(N^2) , as we need to find out n  such maximum pair , will
>> think about O(N0) Algo, if able to do it, will post the Algo here
>>
>> Thanks
>> Shashank Mani
>> Computer Science
>> Birla Institute of Technology,Mesra
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/algogeeks/-/a14Pj22tbJgJ.
>>
>> To post to this group, send email to algogeeks@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 algogeeks@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.
>



-- 

**Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers <=> Save Trees
*BharatKumar Bagana*
**http://www.google.com/profiles/bagana.bharatkumar
*
Mobile +91 8056127652*


-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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] dictionary

2011-09-02 Thread bharatkumar bagana
WHY trie? any reason ?
Dictionary means not only to save efficiently and also we have to get back
in almost O(1) time .. I think Hash Table is best suited for this... Or any
way we have Dictionary Data Structure in Java..

On Fri, Sep 2, 2011 at 3:23 PM, Yuchen Liao  wrote:

> Trie is good, but I prefer inverted index.
>
>
> On Fri, Sep 2, 2011 at 1:38 PM, somya mishra wrote:
>
>> trie
>>
>>
>> On Sat, Sep 3, 2011 at 12:05 AM, sukran dhawan wrote:
>>
>>> trie data structure
>>>
>>>
>>> On Fri, Sep 2, 2011 at 11:21 PM, Aman Kumar  wrote:
>>>
 Hii

 Which data structures can be used for implementation for dictionary?

 which is best/good among them?

 provide good link for that.

 --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@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 algogeeks@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 algogeeks@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.
>>
>
>
>
> --
> from Yuchen Liao via Gmail
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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.
>



-- 

**Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers <=> Save Trees
*BharatKumar Bagana*
**http://www.google.com/profiles/bagana.bharatkumar
*
Mobile +91 8056127652*


-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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] Fire when ready!

2011-09-02 Thread Don
N identical "Soldier" finite automata are in a line in their "Ready"
state. Each Soldier can change states once at every time interval
based on its own current state and the states of the automata
immediately to its right and left. At one end is the General in his
"Aim" state. At the other end is the "Captain" in his "Captain" state.
Give the state transitions as a function of the state of the soldier
and his left and right neighbors to accomplish the following:

At some point, the General changes into "Fire when ready" state. All
the Soldiers, at some interval after the "Fire when ready" command is
given, must change into their "Fire" state. The General and Captain do
not need to "Fire". They serve only as markers for the ends of the
line of soldiers. Any number of intervals can pass between the "Fire
when ready" command and the soldiers firing, but all soldiers must
transition to "Fire" in the same interval. The algorithm must work
regardless of the value of N, and the soldiers do not know the value
of N. Each one knows only his own state and the states of his two
immediate neighbors.

Don

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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: IBM-ISL

2011-09-02 Thread Reynald Suz
Thank you Navneet.

On Sat, Sep 3, 2011 at 8:34 AM, Navneet  wrote:

> I had an offer from IBM ISL, but i did not accept it.
>
> The interview is not very tough. They asked me standard questions like
> detecting loop in linked list, level order traversal etc.
>
> Though i appeared directly for interview and had to write no written
> test as i was interning there.
>
> On Sep 2, 6:54 pm, Reynald  wrote:
> > Hi guys! If any of is familiar with IBM-ISL recruitment process and
> > interview questions, please post. Thank you.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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.
>
>


-- 
Regards
Reynald Reni
Masters in Software Engineering
CIT - India

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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] dictionary

2011-09-02 Thread sukran dhawan
what is inverted index ?

On Sat, Sep 3, 2011 at 12:53 AM, Yuchen Liao  wrote:

> Trie is good, but I prefer inverted index.
>
>
> On Fri, Sep 2, 2011 at 1:38 PM, somya mishra wrote:
>
>> trie
>>
>>
>> On Sat, Sep 3, 2011 at 12:05 AM, sukran dhawan wrote:
>>
>>> trie data structure
>>>
>>>
>>> On Fri, Sep 2, 2011 at 11:21 PM, Aman Kumar  wrote:
>>>
 Hii

 Which data structures can be used for implementation for dictionary?

 which is best/good among them?

 provide good link for that.

 --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@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 algogeeks@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 algogeeks@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.
>>
>
>
>
> --
> from Yuchen Liao via Gmail
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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 algogeeks@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] pattern matching

2011-09-02 Thread sukran dhawan
start drom brue force.then interviewer will ask u to optimize it.then refine
it.dont jum into the optimised soln directly

On Sat, Sep 3, 2011 at 12:35 AM, Aman Kumar  wrote:

> Hiii
>
> Friends ,if pattern matching question is asked in the interview , we
> should answer brute force(with some optimization) approach or use
> ADVANCED algorithm like KMP?
>
> I am very much confused regarding this because in on blog i have read
> that we should not use advanced data structure in interview.
>
>
> help me out.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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 algogeeks@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] activation record

2011-09-02 Thread sukran dhawan
activation records keep tracks of information about the subroutines

On Fri, Sep 2, 2011 at 10:13 PM, Kamakshii Aggarwal
wrote:

> what are activation records??
>
> On Fri, Sep 2, 2011 at 9:00 PM, sukran dhawan wrote:
>
>> true
>>
>>
>> On Fri, Sep 2, 2011 at 7:44 PM, priya ramesh <
>> love.for.programm...@gmail.com> wrote:
>>
>>> Allocation and deallocation of activation records is always done using a
>>> stack
>>> (LIFO) structure. True or false??
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@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 algogeeks@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.
>>
>
>
>
> --
> Regards,
> Kamakshi
> kamakshi...@gmail.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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 algogeeks@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] activation record

2011-09-02 Thread bharatkumar bagana
The activation records for all of the active functions are stored in the
region of computer memory called *the stack*. A good way to remember this is
to think of the stack as ``the region of memory where all the activation
records are stacked''.
Allocation and deallocation of activation records is always done in a stack
structure manner : TRUE

On Fri, Sep 2, 2011 at 2:53 PM, rajeev bharshetty wrote:

> http://www.enel.ucalgary.ca/People/Norman/enel339fall2000/activ_rec/
>
> False
>
>
> On Fri, Sep 2, 2011 at 10:13 PM, Kamakshii Aggarwal  > wrote:
>
>> what are activation records??
>>
>>
>> On Fri, Sep 2, 2011 at 9:00 PM, sukran dhawan wrote:
>>
>>> true
>>>
>>>
>>> On Fri, Sep 2, 2011 at 7:44 PM, priya ramesh <
>>> love.for.programm...@gmail.com> wrote:
>>>
 Allocation and deallocation of activation records is always done using a
 stack
 (LIFO) structure. True or false??

 --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@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 algogeeks@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.
>>>
>>
>>
>>
>> --
>> Regards,
>> Kamakshi
>> kamakshi...@gmail.com
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@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.
>>
>
>
>
> --
> Regards
> Rajeev N B 
>
> "*Winners Don't do Different things , they do things Differently"*
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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.
>



-- 

**Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers <=> Save Trees
*BharatKumar Bagana*
**http://www.google.com/profiles/bagana.bharatkumar
*
Mobile +91 8056127652*


-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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: Need algorithm asap

2011-09-02 Thread bharatkumar bagana
@shasank:
how come the valid bipartition s are n/2..
those should be at least n right?
ex:
{1,2,3}
 {1},{2,3}
--{1,2},{3}
--{},{1,2,3}
If this is correct , then for printing sake it takes O(n^2) .
correct me if I'm wrong.

On Fri, Sep 2, 2011 at 2:48 PM, WgpShashank wrote:

> Piyush Has Correct Idea, If You Have N elements in Set/Array You Will Have
> Maximum 2^n Subsets (Power Set), Now Problem Reduced to generate the all
> such subsets , it will take O(2^n*n ) time , Now number of Valid
> Bipartitions are exactly n/2 .
>
> Note: Power Set includes 0 as well
>
> Correct me missed something or provicde any other better approach ?
>
>
> Shashank Mani
> Computer Science
> Birla Institute of Technology,Mesra
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/UUb4EWQof1gJ.
>
> To post to this group, send email to algogeeks@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.
>



-- 

**Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers <=> Save Trees
*BharatKumar Bagana*
**http://www.google.com/profiles/bagana.bharatkumar
*
Mobile +91 8056127652*


-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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: IBM-ISL

2011-09-02 Thread Navneet
I had an offer from IBM ISL, but i did not accept it.

The interview is not very tough. They asked me standard questions like
detecting loop in linked list, level order traversal etc.

Though i appeared directly for interview and had to write no written
test as i was interning there.

On Sep 2, 6:54 pm, Reynald  wrote:
> Hi guys! If any of is familiar with IBM-ISL recruitment process and
> interview questions, please post. Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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] Network Question

2011-09-02 Thread aditya kumar
their wont be any conflict in ip address . coz within dhcp assigns ip
adsress from the pool of available address and within the n/w (LAN) we need
to have unique ip address bt across the n/w (LAN) we can use same ip from
the pool of ip addresses .


On Sat, Sep 3, 2011 at 1:56 AM, sagar pareek  wrote:

> It is urgent to get the answer thats why i m posting network question
> here... searching on net is not working
>
>  HI !!
> I stuck on a question related to VLSM
>
> Suppose we have two subnets as
>
> 10.0.1.0/24   valid ip address can be 10.0.1.2
>
> and
>
> 10.0.1.0/26 here also valid ip address can be 10.0.1.2
>
> now suppose we are using these two subnets in a LAN and having this ip
> (10.0.1.2) in both the subnets then is there any IP conflict will happen or
> not?
>
> --
> **Regards
> SAGAR PAREEK
> COMPUTER SCIENCE AND ENGINEERING
> NIT ALLAHABAD
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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 algogeeks@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: subarray wid sum=k

2011-09-02 Thread WgpShashank
Yes Neha, I Never Said That SubArray has to be Started from 0th index,else 
What Will be the advantage of this saying subarray anyways, here O(N) time & 
O(N) space solution 

   int prefix_sum = 0;
  hash_map find_subarray;
  int start_index = -1, end_index = -1;
  for (int i = 0,;i < n; ++i) 
  {
  
if (a[i]==k) 
{
   start_index = i;
   end_index = i;
   break;
}
  prefix_sum += a[i];

  if (prefix_sum==k) 
 {
start_index = 0;
end_index = i;
break;
}

if (find_subarray.find(prefix_sum) == k) 
{
find_subarray[prefix_sum] = i;
}
else 
{
start_index = find_subarray[prefix_sum] + 1;
end_index = i;
break;
}
  }
  
  if (start_index != -1) 
  {
cout << "Zero sum subarray found. Start index : " << start_index
 << ". End Index: " << end_index << "\n";
  }


-2 1 -2 5 -1 4 -6 -7 k=9 subarray will be -2 5-1 4 -6

@all Whats Say ?




Shashank Mani
Computer Science
Birla Institute of Technology,Mesra

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/SNpbdnf1PTMJ.
To post to this group, send email to algogeeks@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] Network Question

2011-09-02 Thread sagar pareek
It is urgent to get the answer thats why i m posting network question
here... searching on net is not working

 HI !!
I stuck on a question related to VLSM

Suppose we have two subnets as

10.0.1.0/24   valid ip address can be 10.0.1.2

and

10.0.1.0/26 here also valid ip address can be 10.0.1.2

now suppose we are using these two subnets in a LAN and having this ip
(10.0.1.2) in both the subnets then is there any IP conflict will happen or
not?

-- 
**Regards
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT ALLAHABAD

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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: Find Max Sum Value Pairs

2011-09-02 Thread Piyush Grover
if I have understood the question correctly then:

a[n-1] + b[i] > a[j] + b[i] for all 0 <= j <  n-1
and a[j] + b[n-1] > a[j] + b[i] for all 0 <= i < n-1
therefore,

i = j =n-1;
count = 1;
S[0] <-- (a[n-1], b[n-1])
p = a[n-1] + b[n-2];
q = a[n-2] + b[n-1]

while(count < n){

if(p > q){
 j--;
 S[count++] <-- (a[n-1], b[j]);
}else{
i--;
S[count++]  <-- (a[i], b[n-1]);
}

p = a[n-1] + b[j-1];
q = a[i-1] + b[n-1];

}
Time complexity: O(n)  :  http://ideone.com/FXfVj


On Fri, Sep 2, 2011 at 10:05 PM, WgpShashank wrote:

> @Dave Correct , Missed to Provide the Correct Time Complexity in Worst Case
> it Will be O(N^2) , as we need to find out n  such maximum pair , will think
> about O(N0) Algo, if able to do it, will post the Algo here
>
> Thanks
> Shashank Mani
> Computer Science
> Birla Institute of Technology,Mesra
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/a14Pj22tbJgJ.
>
> To post to this group, send email to algogeeks@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 algogeeks@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] pattern matching

2011-09-02 Thread Ankur Garg
Use KMP dude if u know it ...Who told not to use it ??

Dont read absurd things from net

Regards
Ankur

On Sat, Sep 3, 2011 at 12:35 AM, Aman Kumar  wrote:

> Hiii
>
> Friends ,if pattern matching question is asked in the interview , we
> should answer brute force(with some optimization) approach or use
> ADVANCED algorithm like KMP?
>
> I am very much confused regarding this because in on blog i have read
> that we should not use advanced data structure in interview.
>
>
> help me out.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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 algogeeks@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: Find the Max from each sub-array of size k Options

2011-09-02 Thread icy`
I apologize to the group; i meant to post as reply to "Find the Max
from each sub-array of size k"  but I accidentally selected the word
"Options" as well.  Sorry.

On Sep 2, 3:42 pm, "icy`"  wrote:
> comparison/benchmarks of the
> 1) naive method, which just calls max with every new index, up to size of
> array - k
> 2) my method , which only makes a call to max if the old max is out of range
> or the newest/very rightmost element is greater than max
>
> ruby code:
> [image: max_subarray_text.png]
>
> benchmark output:
> [image: max_subarray_output.png]
>
> To test this, I had shuffled an array of size 1000 with k=25.    I also
> called each method 1000 times, which shows  5x improvement over naive method
>
> icy`
>
>  max_subarray_output.png
> 3KViewDownload
>
>  max_subarray_text.png
> 26KViewDownload

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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] Find the Max from each sub-array of size k Options

2011-09-02 Thread icy`
comparison/benchmarks of the
1) naive method, which just calls max with every new index, up to size of
array - k
2) my method , which only makes a call to max if the old max is out of range
or the newest/very rightmost element is greater than max

ruby code:
[image: max_subarray_text.png]

benchmark output:
[image: max_subarray_output.png]


To test this, I had shuffled an array of size 1000 with k=25.I also
called each method 1000 times, which shows  5x improvement over naive method

icy`

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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] dictionary

2011-09-02 Thread Yuchen Liao
Trie is good, but I prefer inverted index.

On Fri, Sep 2, 2011 at 1:38 PM, somya mishra  wrote:

> trie
>
>
> On Sat, Sep 3, 2011 at 12:05 AM, sukran dhawan wrote:
>
>> trie data structure
>>
>>
>> On Fri, Sep 2, 2011 at 11:21 PM, Aman Kumar  wrote:
>>
>>> Hii
>>>
>>> Which data structures can be used for implementation for dictionary?
>>>
>>> which is best/good among them?
>>>
>>> provide good link for that.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@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 algogeeks@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 algogeeks@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.
>



-- 
from Yuchen Liao via Gmail

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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: subarray wid sum=k

2011-09-02 Thread WgpShashank
@bharat , I never Said that subarray can't start from middle or have to 
start from 0th index :)


Shashank Mani
Computer Science
Birla Institute of Technology,Mesra

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/jUN6eiegbUoJ.
To post to this group, send email to algogeeks@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] pattern matching

2011-09-02 Thread Aman Kumar
Hiii

Friends ,if pattern matching question is asked in the interview , we
should answer brute force(with some optimization) approach or use
ADVANCED algorithm like KMP?

I am very much confused regarding this because in on blog i have read
that we should not use advanced data structure in interview.


help me out.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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] activation record

2011-09-02 Thread rajeev bharshetty
http://www.enel.ucalgary.ca/People/Norman/enel339fall2000/activ_rec/

False

On Fri, Sep 2, 2011 at 10:13 PM, Kamakshii Aggarwal
wrote:

> what are activation records??
>
>
> On Fri, Sep 2, 2011 at 9:00 PM, sukran dhawan wrote:
>
>> true
>>
>>
>> On Fri, Sep 2, 2011 at 7:44 PM, priya ramesh <
>> love.for.programm...@gmail.com> wrote:
>>
>>> Allocation and deallocation of activation records is always done using a
>>> stack
>>> (LIFO) structure. True or false??
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@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 algogeeks@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.
>>
>
>
>
> --
> Regards,
> Kamakshi
> kamakshi...@gmail.com
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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.
>



-- 
Regards
Rajeev N B 

"*Winners Don't do Different things , they do things Differently"*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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: Need algorithm asap

2011-09-02 Thread WgpShashank
Piyush Has Correct Idea, If You Have N elements in Set/Array You Will Have 
Maximum 2^n Subsets (Power Set), Now Problem Reduced to generate the all 
such subsets , it will take O(2^n*n ) time , Now number of Valid 
Bipartitions are exactly n/2 .

Note: Power Set includes 0 as well 

Correct me missed something or provicde any other better approach ?


Shashank Mani
Computer Science
Birla Institute of Technology,Mesra


-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/UUb4EWQof1gJ.
To post to this group, send email to algogeeks@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] dictionary

2011-09-02 Thread somya mishra
trie

On Sat, Sep 3, 2011 at 12:05 AM, sukran dhawan wrote:

> trie data structure
>
>
> On Fri, Sep 2, 2011 at 11:21 PM, Aman Kumar  wrote:
>
>> Hii
>>
>> Which data structures can be used for implementation for dictionary?
>>
>> which is best/good among them?
>>
>> provide good link for that.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@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 algogeeks@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 algogeeks@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] dictionary

2011-09-02 Thread sukran dhawan
trie data structure

On Fri, Sep 2, 2011 at 11:21 PM, Aman Kumar  wrote:

> Hii
>
> Which data structures can be used for implementation for dictionary?
>
> which is best/good among them?
>
> provide good link for that.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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 algogeeks@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] Need algorithm asap

2011-09-02 Thread Piyush Kapoor
I think it is simply printing the subsets.Let Y1 be a subset,then Y-Y1 will
be Y2,which will give u all the partitions...

On Fri, Sep 2, 2011 at 7:04 PM, kranthi raj  wrote:

> I have a list / array Y (with n elements in it), and write an algorithm
> which gives all valid bipartitions (Y1 ,Y2) of Y.
>
> --
>Sincerely,
> Kranthi Raj A
> 2nd Mtech
> Dept Of Computer Science ,
> Indian Institute of Technology, Madras
>#9884989577
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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.
>



-- 
*Regards,*
*Piyush Kapoor,*
*2nd year,CSE
IT-BHU*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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] akamai

2011-09-02 Thread aditya kumar
haha ya i missd one zero its rs 1008000 ctc

On Fri, Sep 2, 2011 at 6:09 PM, sukran dhawan wrote:

> i think u missed a zero :)
>
>
> On Fri, Sep 2, 2011 at 5:49 PM, aditya kumar  > wrote:
>
>> Rs 100800 // this is CTC
>> basic pay is around 7lakhs
>>
>>
>> On Fri, Sep 2, 2011 at 1:15 PM, sukran dhawan wrote:
>>
>>> how much they pay ?
>>>
>>> On Fri, Sep 2, 2011 at 11:24 AM, aditya kumar <
>>> aditya.kumar130...@gmail.com> wrote:
>>>
 they basically ask questions on DBMS and networking.
 In DBMS fst round mainly had SQL and 1 coding question related to ER
 DIAGRAM .
 in written round 3 question ws thr
 1)ER diagram
 2)stack n que
 3)print this pattrn for n=3
 X***X
 *X*X*
 **X***X**
 ***X*X***
 X
 ***X*X***
 **X***X**
 *X*X*
 X***X

 hope it helps :)


 On Thu, Sep 1, 2011 at 10:09 PM, somya mishra 
 wrote:

> akamai is visiting our campus on 03 sept can any1 tell sample question
> that they might ask thanx in advance
>
> --
> You received this message because you are subscribed to the Google
> Groups "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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 algogeeks@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 algogeeks@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 algogeeks@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 algogeeks@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 algogeeks@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] Amazon Interview

2011-09-02 Thread Rahul Verma
Hi friends,

Is there anyone who given the first telephonic round of Amazon recently. 
Please share the details with us.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/FVYRU6rdxH0J.
To post to this group, send email to algogeeks@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] dictionary

2011-09-02 Thread Aman Kumar
Hii

Which data structures can be used for implementation for dictionary?

which is best/good among them?

provide good link for that.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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] uregent advice needdedddd........

2011-09-02 Thread prince . gupta117
 SISO Banglore is best among 3 , then SISC Noida and then SEL Noida.

On Fri, Sep 2, 2011 at 8:21 PM, rahul sharma wrote:

> plz guys tell me wich samsung is better out of 3 in india...n
> plz suggest should i apply for samsung noida or not???
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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 algogeeks@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] Info works applications

2011-09-02 Thread raj kumar
Is there anyone in this  group  who cleared the prior examination of works
applications..

reply asap

thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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] Find the Max from each sub-array of size k

2011-09-02 Thread Anup Ghatage
I just checked Shashank's blog post. The Deque solution is awesome :)

-- 
Anup Ghatage

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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] solution

2011-09-02 Thread MADHUSUDAN BALAI
What we do to remove error??
#include
extern int var;
main()
{
 var=10;
 return 0;
}*
Answer :
*Linker Error : Undefined  reference to 'var'
*
Explanation*:
extern storage class in the following declaration, extern int var; specifies
to the compiler that the memory for i is allocated in some  other program
and that address will be given to the current program at the  time of
linking. But linker finds that no other variable of name var is  available
in any other program with memory space allocated for it. Hence a linker
error has occurred .
*soution :* to remove error we have to eliminate the extern keyword before
the 'int'  at the declaring the var variable
with regardas
Madhusudan balai
indian institue of information techonology allahabd

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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] activation record

2011-09-02 Thread Kamakshii Aggarwal
what are activation records??

On Fri, Sep 2, 2011 at 9:00 PM, sukran dhawan wrote:

> true
>
>
> On Fri, Sep 2, 2011 at 7:44 PM, priya ramesh <
> love.for.programm...@gmail.com> wrote:
>
>> Allocation and deallocation of activation records is always done using a
>> stack
>> (LIFO) structure. True or false??
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@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 algogeeks@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.
>



-- 
Regards,
Kamakshi
kamakshi...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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] uregent advice needdedddd........

2011-09-02 Thread santosh mahto
Samsung Bangalore..
I am working here.

On Fri, Sep 2, 2011 at 8:21 PM, rahul sharma wrote:

> plz guys tell me wich samsung is better out of 3 in india...n
> plz suggest should i apply for samsung noida or not???
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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 algogeeks@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: Find Max Sum Value Pairs

2011-09-02 Thread WgpShashank
@Dave Correct , Missed to Provide the Correct Time Complexity in Worst Case 
it Will be O(N^2) , as we need to find out n  such maximum pair , will think 
about O(N0) Algo, if able to do it, will post the Algo here 

Thanks
Shashank Mani
Computer Science
Birla Institute of Technology,Mesra

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/a14Pj22tbJgJ.
To post to this group, send email to algogeeks@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] activation record

2011-09-02 Thread sukran dhawan
true

On Fri, Sep 2, 2011 at 7:44 PM, priya ramesh  wrote:

> Allocation and deallocation of activation records is always done using a
> stack
> (LIFO) structure. True or false??
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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 algogeeks@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: Find Max Sum Value Pairs

2011-09-02 Thread Dave
@Shashank: Without looking over your algorithm in detail, let me just
say that it solves a different problem than the one asked by the
original poster. You are finding the kth maximum sum, but the problem
asks to find all of the first n maximum sums. So you would have to
apply your algorithm n times. The total complexity for the original
problem would be O(n^2).

Dave

On Sep 2, 5:18 am, WgpShashank  wrote:
> Yes I Think Its Obviously O(N) Algorithm :P
>
> Here is Approach
>
> Algorithm:
> Take 0th index value from 1st array & 1st index value from 2nd array store
> it in S1
> Now 0th index value from 2nd array & 1st index value from 1st array , store
> in S2
> Also stores starting & ending index of each array -take care-off
>
>  initialize maxsum variable to a[0]+b[0]
> Keep checking until we found kth sum from array a & b where a is from 1st &
> b is from
> if s1>s2 then increment array b lastindex until its equal to length of this
> array  & update maxsum=s1
> else then increment array a last-index until its equal to length of this
> array
> maxsum=s2;
>
> Finally Return maxsum;
>
> Here is More 
> infohttp://shashank7s.blogspot.com/2011/08/find-kth-largest-sumab-possibl...
>
> Thanks
> Shashank Mani
> Computer Science
> Birla Institute of Technology,Mesra

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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] uregent advice needdedddd........

2011-09-02 Thread rahul sharma
plz guys tell me wich samsung is better out of 3 in india...n
plz suggest should i apply for samsung noida or not???

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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: subarray wid sum=k

2011-09-02 Thread manish kapur
@ashima..wat will b the complexity of ur algo?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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] activation record

2011-09-02 Thread priya ramesh
Allocation and deallocation of activation records is always done using a
stack
(LIFO) structure. True or false??

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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: subarray wid sum=k

2011-09-02 Thread Ashima .
Logic: since n numbers are there,so there can be (2^n)-1 cases.Just as for n
bits we have 2^n possible combinations.
Keeping above logic in mind,We can also create a binary tree with root node
as 0.From there create 2 child nodes:1)number 2) 0. 1st child node indicates
that number was taken in subset and 2nd child node indicates that number was
not taken.similarly make a tree with all such possible combinations.
FInd sum corresponding to all the the paths.
If that sum =k(given) then it means subset exists.Else not.
Ashima
M.Sc.(Tech)Information Systems
4th year
BITS Pilani
Rajasthan




On Fri, Sep 2, 2011 at 5:26 AM, manish kapur wrote:

> @bharatkumar..cn u pls share the algo
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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 algogeeks@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] Find the Max from each sub-array of size k

2011-09-02 Thread beginner
i think the problem can also be solved by DP..

arr is the original array..
final is the array required..

for(i=0;ihttps://groups.google.com/d/msg/algogeeks/-/XWcOWYyt8B0J.
To post to this group, send email to algogeeks@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 interview

2011-09-02 Thread Vikram Singh
how abt this:

if(!a[0][0])
{
first traverse the 1st row till we find 1.
if dere is 1 do a[0][0]+=2;
then traverse the first column till 1..
if dere is 1... do a[0][0]+=3;
}

apply dave's method

if(a[0][0]==2)
make 1st row 1

else if(a[0][0]==3)
make 1st column 1...

else if(a[0][0]==5 || a[0][0]==1)
make both 1st row and col 1...



On Sep 2, 12:32 pm, kranthi raj  wrote:
> oops missed Space Complexity
>
>
>
>
>
> On Fri, Sep 2, 2011 at 12:55 PM, kranthi raj  wrote:
> > for( i = 0 ; i < n ; ++i )
> >    for( j = 0 ; j < m ; ++j )
> >        if( a[i][j] != 0 )
> >             row[j]=col[i]=1;
>
> > for( i = 0 ; i < n ; ++i )
> >    for( j = 0 ; j < m ; ++j )
>
> >        {
> >            if (row[j]==1 || col[i]==1)
> >                  a[i][j]=1;
> >        }
>
> > Does this work?
>
> --
>    Sincerely,
>     Kranthi Raj A
>     2nd Mtech
>     Dept Of Computer Science ,
>     Indian Institute of Technology, Madras
>    
> #9884989577begin_of_the_skype_highlighting  9884989577  end_of_the_skype_highlighting

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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 interview

2011-09-02 Thread Vikram Singh
how abt this:

if(!a[0][0])
{
first traverse the 1st row till we find any 1...

On Sep 2, 12:32 pm, kranthi raj  wrote:
> oops missed Space Complexity
>
>
>
>
>
> On Fri, Sep 2, 2011 at 12:55 PM, kranthi raj  wrote:
> > for( i = 0 ; i < n ; ++i )
> >    for( j = 0 ; j < m ; ++j )
> >        if( a[i][j] != 0 )
> >             row[j]=col[i]=1;
>
> > for( i = 0 ; i < n ; ++i )
> >    for( j = 0 ; j < m ; ++j )
>
> >        {
> >            if (row[j]==1 || col[i]==1)
> >                  a[i][j]=1;
> >        }
>
> > Does this work?
>
> --
>    Sincerely,
>     Kranthi Raj A
>     2nd Mtech
>     Dept Of Computer Science ,
>     Indian Institute of Technology, Madras
>    
> #9884989577begin_of_the_skype_highlighting  9884989577  end_of_the_skype_highlighting

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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] IBM-ISL

2011-09-02 Thread Reynald
Hi guys! If any of is familiar with IBM-ISL recruitment process and
interview questions, please post. Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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] Need algorithm asap

2011-09-02 Thread kranthi raj
I have a list / array Y (with n elements in it), and write an algorithm
which gives all valid bipartitions (Y1 ,Y2) of Y.

-- 
   Sincerely,
Kranthi Raj A
2nd Mtech
Dept Of Computer Science ,
Indian Institute of Technology, Madras
   #9884989577

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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: Static variable memory location

2011-09-02 Thread Gene
The first sentence is incorrect for any compiler I've ever seen, and
that's a bunch.  As has been said, the C standard doesnt' say where
_any_ variables live.  So you can only ask the question with respect
to certain compiler.

On Sep 2, 1:57 am, aditya kumar  wrote:
> static variables are allocated on heap . and global variables are sored on
> data segment
>
> On Fri, Sep 2, 2011 at 9:30 AM, rahul sharma wrote:
>
>
>
> > static variable is stored in data segement so it is alive thorugh the
> > proggo through let us c : data types
>
> > On Wed, Aug 31, 2011 at 10:16 PM, Swathi  wrote:
>
> >> C standard doens't fine where it has to be stored.. go through this URL
>
> >>http://www.velocityreviews.com/forums/t443436-where-is-a-static-varia...
>
> >> On Wed, Aug 31, 2011 at 9:57 PM, rohit  wrote:
>
> >>> Where does a static variable get allocated in memory..?
> >>> Like automatic variables get stack, objects allocated through
> >>> malloc/calloc get memory from heap...wt abt static variable?
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "Algorithm Geeks" group.
> >>> To view this discussion on the web visit
> >>>https://groups.google.com/d/msg/algogeeks/-/5Wj2C8yF74QJ.
> >>> To post to this group, send email to algogeeks@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 algogeeks@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 algogeeks@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 algogeeks@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] akamai

2011-09-02 Thread sukran dhawan
i think u missed a zero :)

On Fri, Sep 2, 2011 at 5:49 PM, aditya kumar
wrote:

> Rs 100800 // this is CTC
> basic pay is around 7lakhs
>
>
> On Fri, Sep 2, 2011 at 1:15 PM, sukran dhawan wrote:
>
>> how much they pay ?
>>
>> On Fri, Sep 2, 2011 at 11:24 AM, aditya kumar <
>> aditya.kumar130...@gmail.com> wrote:
>>
>>> they basically ask questions on DBMS and networking.
>>> In DBMS fst round mainly had SQL and 1 coding question related to ER
>>> DIAGRAM .
>>> in written round 3 question ws thr
>>> 1)ER diagram
>>> 2)stack n que
>>> 3)print this pattrn for n=3
>>> X***X
>>> *X*X*
>>> **X***X**
>>> ***X*X***
>>> X
>>> ***X*X***
>>> **X***X**
>>> *X*X*
>>> X***X
>>>
>>> hope it helps :)
>>>
>>>
>>> On Thu, Sep 1, 2011 at 10:09 PM, somya mishra wrote:
>>>
 akamai is visiting our campus on 03 sept can any1 tell sample question
 that they might ask thanx in advance

 --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@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 algogeeks@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 algogeeks@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 algogeeks@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 algogeeks@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: subarray wid sum=k

2011-09-02 Thread manish kapur
@bharatkumar..cn u pls share the algo

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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] akamai

2011-09-02 Thread aditya kumar
Rs 100800 // this is CTC
basic pay is around 7lakhs

On Fri, Sep 2, 2011 at 1:15 PM, sukran dhawan wrote:

> how much they pay ?
>
> On Fri, Sep 2, 2011 at 11:24 AM, aditya kumar <
> aditya.kumar130...@gmail.com> wrote:
>
>> they basically ask questions on DBMS and networking.
>> In DBMS fst round mainly had SQL and 1 coding question related to ER
>> DIAGRAM .
>> in written round 3 question ws thr
>> 1)ER diagram
>> 2)stack n que
>> 3)print this pattrn for n=3
>> X***X
>> *X*X*
>> **X***X**
>> ***X*X***
>> X
>> ***X*X***
>> **X***X**
>> *X*X*
>> X***X
>>
>> hope it helps :)
>>
>>
>> On Thu, Sep 1, 2011 at 10:09 PM, somya mishra wrote:
>>
>>> akamai is visiting our campus on 03 sept can any1 tell sample question
>>> that they might ask thanx in advance
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@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 algogeeks@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 algogeeks@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 algogeeks@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] Static variable memory location

2011-09-02 Thread rahul sharma
function argument as stativ vairbales then tehy are creted on data segment
 and normal on stack.

On Fri, Sep 2, 2011 at 11:27 AM, aditya kumar
wrote:

> static variables are allocated on heap . and global variables are sored on
> data segment
>
>
> On Fri, Sep 2, 2011 at 9:30 AM, rahul sharma wrote:
>
>> static variable is stored in data segement so it is alive thorugh the
>> proggo through let us c : data types
>>
>>
>> On Wed, Aug 31, 2011 at 10:16 PM, Swathi  wrote:
>>
>>> C standard doens't fine where it has to be stored.. go through this URL
>>>
>>> http://www.velocityreviews.com/forums/t443436-where-is-a-static-variable-stored.html
>>>
>>>
>>>
>>> On Wed, Aug 31, 2011 at 9:57 PM, rohit  wrote:
>>>
 Where does a static variable get allocated in memory..?
 Like automatic variables get stack, objects allocated through
 malloc/calloc get memory from heap...wt abt static variable?

 --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/5Wj2C8yF74QJ.
 To post to this group, send email to algogeeks@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 algogeeks@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 algogeeks@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 algogeeks@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 algogeeks@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: Hexadecimal to Decimal

2011-09-02 Thread Gene
I'll add that both gcc and VC do a nice job of compiling this for x86:
almostt identical code, 35 instructions in 88 bytes.

An issue with the ctype.h functions - again only important in tight
environments - is that some implementations use tables that are 1024
bytes.

On Sep 1, 5:55 pm, Gene  wrote:
> The language does give it tyou in sscanf, but sscanf is a pretty big
> function and in some environments, like small embedded ones, you don't
> get the luxury of using a big block of  code to do a small thing.
>
> unsigned hex_to_unsigned(char *p)
> {
>   unsigned val = 0;
>   while (*p != '\0') {
>     char c = *p++;
>     if ('a' <= c && c <= 'f')
>       val = (val << 4) + (c - 'a' + 10);
>     else if ('A' <= c && c <= 'F')
>       val = (val << 4) + (c - 'A' + 10);
>     else if ('0' <= c && c <= '9')
>       val = (val << 4) + (c - '0');
>     else break;  // quit early on non-hex char
>  }
>  return val;
>
> }
>
> On Sep 1, 12:34 pm, rShetty  wrote:
>
>
>
> > Given a Hexadecimal value as a string, give a C Code to convert it
> > into decimal value?
> > If 0xff then output should be 255.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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: subarray wid sum=k

2011-09-02 Thread bharatkumar bagana
we have to consider 3 cases ..
1) that sub array can be in first half
2) that sub array can be in second half
3) that sub array can be in middle .

On Fri, Sep 2, 2011 at 7:56 AM, bharatkumar bagana <
bagana.bharatku...@gmail.com> wrote:

> we can do this without taking O(n) space .. but time is O(n^2) as in i
> already mentioned where the solution is ...
>
>
> On Fri, Sep 2, 2011 at 7:35 AM, Neha Singh wrote:
>
>> @Shashank : I think the sub array need not start from the the index 0. For
>> eg: If the array is of size 10, then the sub array can be from index 3 to 7.
>> Here is my solution :
>>
>> Given : int arr[size] , int sum
>> 1. Take an array prefix_sum[size]
>> 2. int temp=0;prefix_sum[0]=0;
>> for(int i=0;i> {
>> temp+=arr[i];
>> prefix_sum[i]=temp;
>>}
>> 3. for (int i=0;i>for(int j=0;j<=i;j++)
>>{
>>if(prefix_sum[i]-prefix_sum[j]+arr[j]  == sum)
>>printf("%d  %d",i,j);  // sub array from index i to j is
>> the required sub array
>>}
>>
>>
>> Time : O(n^2)
>> Space : 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 algogeeks@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.
>>
>
>
>
> --
>
> **Please do not print this e-mail until urgent requirement. Go Green!!
> Save Papers <=> Save Trees
> *BharatKumar Bagana*
> **http://www.google.com/profiles/bagana.bharatkumar
> *
> Mobile +91 8056127652*
> 
>
>
>


-- 

**Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers <=> Save Trees
*BharatKumar Bagana*
**http://www.google.com/profiles/bagana.bharatkumar
*
Mobile +91 8056127652*


-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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: subarray wid sum=k

2011-09-02 Thread bharatkumar bagana
we can do this without taking O(n) space .. but time is O(n^2) as in i
already mentioned where the solution is ...

On Fri, Sep 2, 2011 at 7:35 AM, Neha Singh wrote:

> @Shashank : I think the sub array need not start from the the index 0. For
> eg: If the array is of size 10, then the sub array can be from index 3 to 7.
> Here is my solution :
>
> Given : int arr[size] , int sum
> 1. Take an array prefix_sum[size]
> 2. int temp=0;prefix_sum[0]=0;
> for(int i=0;i {
> temp+=arr[i];
> prefix_sum[i]=temp;
>}
> 3. for (int i=0;ifor(int j=0;j<=i;j++)
>{
>if(prefix_sum[i]-prefix_sum[j]+arr[j]  == sum)
>printf("%d  %d",i,j);  // sub array from index i to j is the
> required sub array
>}
>
>
> Time : O(n^2)
> Space : 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 algogeeks@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.
>



-- 

**Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers <=> Save Trees
*BharatKumar Bagana*
**http://www.google.com/profiles/bagana.bharatkumar
*
Mobile +91 8056127652*


-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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] Find the Max from each sub-array of size k

2011-09-02 Thread rajul jain
I think Dave has already given a good solution in earlier post.

first make a max heap of first k elements and then print max value which is
root .
now add next element in heap and again print max value  follow this
procedure till you reach end of an array.

On Fri, Sep 2, 2011 at 9:04 AM, Anup Ghatage  wrote:

> Given an unsorted Array A and any integer k where k <= size of A
>
> Print the maximum of each sub-array of size k of A.
>
> eg:  A = [ 3, 5, 1, 9, 0, 4, -1, 7 ]   k = 4
> Max: 9 9 9 9 7
>
> --
> Anup Ghatage
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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 algogeeks@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] Find the Max from each sub-array of size k

2011-09-02 Thread vishal jain
 I made a small program with window size k = 2;

int max(int n, int m)
{
 if ( n > m )
 return n;
 else
 return m;
}
int main()
{
int arr[8]={3,5,1,9,0,4,-1,7};
int i,j;
for (i=0;i!=j && i<=7;i++)
for (j=0;j!=i && j<=7; j++)
{
int k = max(arr[i], arr[j]);
cout<<"[" Hi Anup , here is naive approach
>
> There is a sliding window of size w which is moving from the very left of
> the array to the very right. You can only see the w numbers in the window.
> Each time the sliding window moves rightwards by one position.
>
> Following is an example:
> The array is [1 3 -1 -3 5 3 6 7], and w is 3.
>
> Window position Max
> --- -
> [1 3 -1] -3 5 3 6 7 3
> 1 [3 -1 -3] 5 3 6 7 3
> 1 3 [-1 -3 5] 3 6 7 5
> 1 3 -1 [-3 5 3] 6 7 5
> 1 3 -1 -3 [5 3 6] 7 6
> 1 3 -1 -3 5 [3 6 7] 7
>
> The obvious solution with run time complexity of O(nw) is which is not
> efficient enough. Every time the window is moved, we have to search for the
> maximum from w elements in the window. where w is size of window & n is size
> of array
>
> 1st Method(Naive Approach)
>
> Data Structure Used : Array
> Algorithm: A.for all i=0 to n-w+1 (we should have at-least w elements in
> window)
> B.for all j=i to i+w (keep incrementing windows size form left to right)
> C find maximum inn each window & print it or put in array (Auxiliary)
>
> For more efficient approaches you can have a look here
>
> http://shashank7s.blogspot.com/2011/06/given-array-and-integer-k-find-maximum.html
>
> correct me if anything wrong or other approaches you can thing of ?
>
> Thanks
> Shashank Mani
> Computer Science
> Birla Institute of Technology Mesra
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/m1R83UHfc2UJ.
>
> To post to this group, send email to algogeeks@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 algogeeks@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: subarray wid sum=k

2011-09-02 Thread Neha Singh
@Shashank : I think the sub array need not start from the the index 0. For
eg: If the array is of size 10, then the sub array can be from index 3 to 7.
Here is my solution :

Given : int arr[size] , int sum
1. Take an array prefix_sum[size]
2. int temp=0;prefix_sum[0]=0;
for(int i=0;ihttp://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Data Structure Question

2011-09-02 Thread sukran dhawan
stack

On Fri, Sep 2, 2011 at 11:32 AM, sharmila saru wrote:

> k k
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/C6ETapRdgvQJ.
>
> To post to this group, send email to algogeeks@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 algogeeks@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] C project

2011-09-02 Thread Rajeshwar Patra
There was a book named as "C projects"
Does anyone has a link for downloading the book.

-- 
*Rajeshwar Patra,*
*MCA final year,*
*Nit Durgapur*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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: subarray wid sum=k

2011-09-02 Thread bharatkumar bagana
@shasank; i don't think it works...
prefix sum means u are taking sum from starting index ... sub array can be
from middle ..It is like max sub array in an array problem ...O(n^2) algo is
available in Cormen text book .google it .

On Fri, Sep 2, 2011 at 6:05 AM, manish kapur wrote:

> r u sure space used is 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 algogeeks@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.
>



-- 

**Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers <=> Save Trees
*BharatKumar Bagana*
**http://www.google.com/profiles/bagana.bharatkumar
*
Mobile +91 8056127652*


-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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: subarray wid sum=k

2011-09-02 Thread hemank lamba
The problem in this solution might be the fact that you will get the sub
array only if the prefix sum is k... so here we are not using prev index.


On Fri, Sep 2, 2011 at 3:17 PM, WgpShashank wrote:

> I Think We can Use HashTable , as Its Sub-Array you are asking about , its
> obviously contiguous :D
> Calculate prefix sum  , store it in hashtable as key & current index as
> value , once prefix sum=k, print subarray , also keep track of prev index ,
> so that we can print array from prev_i9ndex to current _index where sum=k
>
> Time Complexity O(N)
> Space Complexity O(N)
>
> Correct me if anything wrong ?
>
> Shashank Mani
> Computer Science
> Birla Institute of Technology,Mesra
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/xCl1rX3yv5IJ.
>
> To post to this group, send email to algogeeks@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 algogeeks@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: Find Max Sum Value Pairs

2011-09-02 Thread WgpShashank
Yes I Think Its Obviously O(N) Algorithm :P

Here is Approach 

Algorithm:
Take 0th index value from 1st array & 1st index value from 2nd array store 
it in S1
Now 0th index value from 2nd array & 1st index value from 1st array , store 
in S2
Also stores starting & ending index of each array -take care-off

 initialize maxsum variable to a[0]+b[0] 
Keep checking until we found kth sum from array a & b where a is from 1st & 
b is from 
if s1>s2 then increment array b lastindex until its equal to length of this 
array  & update maxsum=s1
else then increment array a last-index until its equal to length of this 
array 
maxsum=s2;

Finally Return maxsum;

Here is More info 
http://shashank7s.blogspot.com/2011/08/find-kth-largest-sumab-possible-where.html

Thanks
Shashank Mani
Computer Science
Birla Institute of Technology,Mesra

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/AhjalZ6ly_cJ.
To post to this group, send email to algogeeks@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] Find the Max from each sub-array of size k

2011-09-02 Thread WgpShashank
Hi Anup , here is naive approach 

There is a sliding window of size w which is moving from the very left of 
the array to the very right. You can only see the w numbers in the window. 
Each time the sliding window moves rightwards by one position. 

Following is an example: 
The array is [1 3 -1 -3 5 3 6 7], and w is 3. 

Window position Max 
--- - 
[1 3 -1] -3 5 3 6 7 3 
1 [3 -1 -3] 5 3 6 7 3 
1 3 [-1 -3 5] 3 6 7 5 
1 3 -1 [-3 5 3] 6 7 5 
1 3 -1 -3 [5 3 6] 7 6 
1 3 -1 -3 5 [3 6 7] 7 

The obvious solution with run time complexity of O(nw) is which is not 
efficient enough. Every time the window is moved, we have to search for the 
maximum from w elements in the window. where w is size of window & n is size 
of array 

1st Method(Naive Approach) 

Data Structure Used : Array 
Algorithm: A.for all i=0 to n-w+1 (we should have at-least w elements in 
window) 
B.for all j=i to i+w (keep incrementing windows size form left to right) 
C find maximum inn each window & print it or put in array (Auxiliary) 

For more efficient approaches you can have a look here 
http://shashank7s.blogspot.com/2011/06/given-array-and-integer-k-find-maximum.html

correct me if anything wrong or other approaches you can thing of ?

Thanks 
Shashank Mani 
Computer Science 
Birla Institute of Technology Mesra

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/m1R83UHfc2UJ.
To post to this group, send email to algogeeks@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] convert a string into another in minimum number of steps

2011-09-02 Thread WgpShashank
Yes Edit Distance is Most Efficient Algorithms Implemented So far and we all 
know this :P ,
 but Sukran is saying Trie ? seems odd initially but let me analyze it 
,Seems Good to me but we need to store length of strings in advance so that 
while inserting in trie wherever 1st mismatch occurs , we can just subtract 
current index from length of matching sting isn't it ?  for map & man assume 
map is already in trie , when we try to insert man in try mismatch occurs at 
index 2 & length of "man" is 3 so number of steps required to convert is 
1only 

Time Complexity for both search & insert both are constant using Trie O(K) 
where K is length of String which is again constant 

its an approach , may contains bug , let me know if missed something?

Shashank Mani
Computer Science
Birla Institute of Technology,Mesra

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/-ecPCKH4egcJ.
To post to this group, send email to algogeeks@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: Adding Two no without using any operator...??

2011-09-02 Thread WgpShashank
Discussed Several time ,  Search Threads

here is one of the link 

https://groups.google.com/forum/#!searchin/algogeeks/add$20two$20number$20/algogeeks/laWTN1xiwx0/lYoidUsr7mIJ

Thanks 
Shashank Mani 
Computer Science 
Birla Institute of Technology Mesra

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/47liBgz_MkgJ.
To post to this group, send email to algogeeks@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: subarray wid sum=k

2011-09-02 Thread manish kapur
r u sure space used is 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 algogeeks@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] Information about TATA Systems

2011-09-02 Thread pcsin
Hello,
Can anybody provide me with information about TATA systems, broadly
about what kind of company they are. Googling doesn't leads to any
result.
Awaiting the response. :-)

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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] REGARDING SOURCE BITS

2011-09-02 Thread karthik fbk
Hi guys , source bits is visiting our college next week .
If it has come to any of your colleges , share your experience in it.
What kind of questions will they ask in written and also in interview
process .
It would be helpful ..

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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: subarray wid sum=k

2011-09-02 Thread WgpShashank
I Think We can Use HashTable , as Its Sub-Array you are asking about , its 
obviously contiguous :D
Calculate prefix sum  , store it in hashtable as key & current index as 
value , once prefix sum=k, print subarray , also keep track of prev index , 
so that we can print array from prev_i9ndex to current _index where sum=k

Time Complexity O(N)
Space Complexity O(N)

Correct me if anything wrong ?

Shashank Mani
Computer Science
Birla Institute of Technology,Mesra


-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/xCl1rX3yv5IJ.
To post to this group, send email to algogeeks@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] what is the error???

2011-09-02 Thread sukran dhawan
define the variable if u wanna remove the error :P

On Wed, Aug 31, 2011 at 8:26 PM, Rajesh Kumar wrote:

> What we do to remove error??
> #include
> extern int var;
> main()
> {
>  var=10;
>  return 0;
> }
>
> Regards
> Rajesh Kumar
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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 algogeeks@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] subarray wid sum=k

2011-09-02 Thread manish kapur
u have 2 find a continuous subarray...

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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: Find the Max from each sub-array of size k

2011-09-02 Thread sukran dhawan
for(i=0;iwrote:

> we can do it using max heap
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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 algogeeks@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: Find the Max from each sub-array of size k

2011-09-02 Thread amit chandel
we can do it using max heap

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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] subarray wid sum=k

2011-09-02 Thread wujin chen
agree with hemank !

2011/9/2 hemank lamba 

> Are you sure it is not continuous subsets. Because otherwise i guess it is
> a NP problem.
>
>
> On Fri, Sep 2, 2011 at 7:58 AM, manish kapur 
> wrote:
>
>> given an unsorted array of +ve and -ve elements.find a subarray with sum=
>> k  in O(n).
>> you can use some extra space
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@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 algogeeks@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 algogeeks@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] akamai

2011-09-02 Thread sukran dhawan
how much they pay ?

On Fri, Sep 2, 2011 at 11:24 AM, aditya kumar
wrote:

> they basically ask questions on DBMS and networking.
> In DBMS fst round mainly had SQL and 1 coding question related to ER
> DIAGRAM .
> in written round 3 question ws thr
> 1)ER diagram
> 2)stack n que
> 3)print this pattrn for n=3
> X***X
> *X*X*
> **X***X**
> ***X*X***
> X
> ***X*X***
> **X***X**
> *X*X*
> X***X
>
> hope it helps :)
>
>
> On Thu, Sep 1, 2011 at 10:09 PM, somya mishra wrote:
>
>> akamai is visiting our campus on 03 sept can any1 tell sample question
>> that they might ask thanx in advance
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@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 algogeeks@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 algogeeks@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] subarray wid sum=k

2011-09-02 Thread hemank lamba
Are you sure it is not continuous subsets. Because otherwise i guess it is a
NP problem.

On Fri, Sep 2, 2011 at 7:58 AM, manish kapur wrote:

> given an unsorted array of +ve and -ve elements.find a subarray with sum= k
>  in O(n).
> you can use some extra space
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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 algogeeks@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] akamai

2011-09-02 Thread aditya kumar
first round had two sections
1)aptitude and technical
2)coding
then follows two rounds of technical interview and one round of hr

On Fri, Sep 2, 2011 at 11:33 AM, somya mishra wrote:

> thanx man only 2 rounds were there?
>
>
> On Fri, Sep 2, 2011 at 11:24 AM, aditya kumar <
> aditya.kumar130...@gmail.com> wrote:
>
>> they basically ask questions on DBMS and networking.
>> In DBMS fst round mainly had SQL and 1 coding question related to ER
>> DIAGRAM .
>> in written round 3 question ws thr
>> 1)ER diagram
>> 2)stack n que
>> 3)print this pattrn for n=3
>> X***X
>> *X*X*
>> **X***X**
>> ***X*X***
>> X
>> ***X*X***
>> **X***X**
>> *X*X*
>> X***X
>>
>> hope it helps :)
>>
>> On Thu, Sep 1, 2011 at 10:09 PM, somya mishra wrote:
>>
>>> akamai is visiting our campus on 03 sept can any1 tell sample question
>>> that they might ask thanx in advance
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@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 algogeeks@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 algogeeks@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 algogeeks@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: microsoft interview

2011-09-02 Thread kranthi raj
oops missed Space Complexity

On Fri, Sep 2, 2011 at 12:55 PM, kranthi raj  wrote:

> for( i = 0 ; i < n ; ++i )
>for( j = 0 ; j < m ; ++j )
>if( a[i][j] != 0 )
> row[j]=col[i]=1;
>
>
>
> for( i = 0 ; i < n ; ++i )
>for( j = 0 ; j < m ; ++j )
>
>{
>if (row[j]==1 || col[i]==1)
>  a[i][j]=1;
>}
>
>
>
> Does this work?
>



-- 
   Sincerely,
Kranthi Raj A
2nd Mtech
Dept Of Computer Science ,
Indian Institute of Technology, Madras
   #9884989577

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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: microsoft interview

2011-09-02 Thread kranthi raj
for( i = 0 ; i < n ; ++i )
   for( j = 0 ; j < m ; ++j )
   if( a[i][j] != 0 )
row[j]=col[i]=1;


for( i = 0 ; i < n ; ++i )
   for( j = 0 ; j < m ; ++j )

   {
   if (row[j]==1 || col[i]==1)
 a[i][j]=1;
   }



Does this work?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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: Hexadecimal to Decimal

2011-09-02 Thread Don
Sure. Is something wrong with using the functionality already built
into the language?

Here is another way:

int hexToDec(char *string)
{
  int x = 0;
  for(int i = 0; string[i]; ++i)
  {
if (isdigit(string[i]))
  x = (x*16) + string[i] - '0';
else if ((string[i] >= 'a') && (string[i] <= 'f'))
  x = (x*16) + string[i] - 'a' + 10;
  }
  return x;
}

Don

On Sep 1, 11:56 am, rajeev bharshetty  wrote:
> @Don : Thanks , are there any other methods 
>
>
>
> On Thursday, September 1, 2011, Don wrote:
> > int n;
> > char *string = "0xff";  // Or whatever
> > sscanf(string, "%x", &n);
> > printf("%d\n", n);
>
> > On Sep 1, 11:34 am, rShetty > wrote:
> > > Given a Hexadecimal value as a string, give a C Code to convert it
> > > into decimal value?
> > > If 0xff then output should be 255.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to 
> > algogeeks@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.
>
> --
> Regards
> Rajeev N B 
>
> "*Winners Don't do Different things , they do things Differently"*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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] Motorola Interview Question

2011-09-02 Thread Yuchen Liao
That means to prevent the driver from auto loading.

Just open */etc/modprobe.d/blacklist* file and add the driver name using:

*blacklist driver_name*


On Thu, Sep 1, 2011 at 1:29 AM, rajeev bharshetty wrote:

> What does Blacklisting of drivers mean in Linux ?
> Explain How you go about doing Blacklisting of Drivers ? Explain???
>
>
> --
> Regards
> Rajeev N B 
>
> "*Winners Don't do Different things , they do things Differently"*
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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.
>



-- 
from Yuchen Liao via Gmail

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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] Urgent

2011-09-02 Thread Ishan Aggarwal
Hi,

Anyone aware what facebook asks in their first phone call, regarding general
background details and other related information and what should be prepared
for their interview?

-- 
Kind Regards
Ishan Aggarwal
Phone : +91-9654602663

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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: Hexadecimal to Decimal

2011-09-02 Thread Don
Sure there are other ways. But why duplicate functionality already
built into the language?

Here is one way to write your own conversion function:

int hexToDec(char *string)
{
  int x = 0;
  for(int i = 0; string[i]; ++i)
  {
if (isdigit(string[i]))
  x = (x*16) + string[i] - '0';
else if ((string[i] >= 'a') && (string[i] <= 'f'))
  x = (x*16) + string[i] - 'a' + 10;
  }
  return x;
}

On Sep 1, 11:56 am, rajeev bharshetty  wrote:
> @Don : Thanks , are there any other methods 
>
>
>
> On Thursday, September 1, 2011, Don wrote:
> > int n;
> > char *string = "0xff";  // Or whatever
> > sscanf(string, "%x", &n);
> > printf("%d\n", n);
>
> > On Sep 1, 11:34 am, rShetty > wrote:
> > > Given a Hexadecimal value as a string, give a C Code to convert it
> > > into decimal value?
> > > If 0xff then output should be 255.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to 
> > algogeeks@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.
>
> --
> Regards
> Rajeev N B 
>
> "*Winners Don't do Different things , they do things Differently"*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@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.