[algogeeks] Re: thanx to all

2012-03-01 Thread pavan
congrats :)

On Feb 29, 8:28 pm, Umer Farooq the.um...@gmail.com wrote:
 congratz dude! :-)

 And best of luck with your future endeavours.

 On Wed, Feb 29, 2012 at 11:05 PM, Ravi Ranjan ravi.cool2...@gmail.comwrote:









  @all

  3 round liye

  1.5 hours each  only data structure n algorithm n 2 qstns from OS but
  ultimately the code for synchronization(a mix situation of linked-list n
  semaphore)

  they asked linked list tree programs their variations(all to implement in
  C)

  i stuck at this place when they tell me to write minimum separation
  distance between two nodes of tree
  first i use recursion then
  then they tell to write using one recursion and one loop.  :P
  and tell me to explain the stack  formation on memory layout along with
  its complexity...
  i got confused whther combining both loops and stack have same as that of
  two loops/ two recursions
  basically they are creating  some mental pressure for me by confusing me
  crtisizing me.. i was tired till the last interview
  but finally they hired me. :D:D:D:D

  the last round was the difficult one here they are focussin on graph... my
  graph is little weak(implementation part)

  i think most of the qstns were of MS and Amazon(trees n graph optimization)
  and is discussed here..

  thanx a lot to you guys...

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

 --
 Umer

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

2012-02-16 Thread pavan
yeah the results are correct for the given inputs

On Feb 16, 1:03 am, atul anand atul.87fri...@gmail.com wrote:
 if i have understood the problem correctly...
 you please confirm the answers i am getting for the given inputs:-
                           result
 1) 1 2 3 4 5            4
 2) 1 2 3 4 5 6         5
 3) 1 2 3 4 5 6 7      4
 4) 1 2 3 4 5 6 7 8   8

 On Wed, Feb 15, 2012 at 11:38 PM, Dheeraj Sharma 

 dheerajsharma1...@gmail.com wrote:
  yeah..we need to calculate some formula

  On Wed, Feb 15, 2012 at 10:21 PM, pavan pavankri...@gmail.com wrote:

  @Utkarsh: yeah it is josephsus problem with a slight change.using
  a linked list will give u TLE i guess.

  On Feb 14, 10:36 pm, vickywiz vickywiz...@gmail.com wrote:
   in 1 2 3 4 5 6...o/p ll b 5

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

  --
  *Dheeraj Sharma*

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

2012-02-15 Thread pavan
@Utkarsh: yeah it is josephsus problem with a slight change.using
a linked list will give u TLE i guess.


On Feb 14, 10:36 pm, vickywiz vickywiz...@gmail.com wrote:
 in 1 2 3 4 5 6...o/p ll b 5

-- 
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: TRIE problem

2012-02-15 Thread pavan
i am getting WA by implementing TRIE .can anyone help me with the test
cases for which the following code is failing.

#includestdio.h
#includestdlib.h
#includestring.h
#includeiostream
#define MAX 26
#define LEN 1000
using namespace std;


struct node
{
char c;
int isterminal;
int no_children;
struct node* children[MAX];
};
struct node* createnode(char ch)
{
struct node* nl=(struct node*)malloc(sizeof(struct node));
if(nl==NULL)
printf(memory allocation error);
else
{
nl-c=ch;
nl-no_children=0;
nl-isterminal=-1;
}
return nl;
}
struct node* insert(char* str,int i,int len,struct node* root)
{
char ch=str[i];
if(i==len)
{
root-isterminal=1;
return root;
}
if(root-children[ch-'a']==NULL || root-children[ch-'a']-
isterminal==-1)
{
struct node* nl=createnode(ch);
root-children[ch-'a']=nl;
root-children[ch-'a']-isterminal=0;
root-no_children++;
}
root-children[ch-'a']=insert(str,i+1,len,root-children[ch-'a']);
return root;
}
int countchildren(struct node* root,char* buffer,int len)
{
int index=0;
static int count=0;
if(root-isterminal==1)
{
printf(%s\n,buffer);
count++;
}
for(int i=0;iMAX;i++)
{
if(root-children[i]!=NULL)
{
buffer[len]=root-children[i]-c;
buffer[len+1]='\0';
countchildren(root-children[i],buffer,len+1);
}
}
return count;
}
int solve(char* str,int i,int len,struct node* root)
{
int c;
char ch=str[i];
char buffer[LEN];
if(ilen)
{
if(root==NULL || root-children[ch-'a']==NULL)
return 0;
else
{
return solve(str,i+1,len,root-children[ch-'a']);
}
}
else
{
strcpy(buffer,str);
c=countchildren(root,buffer,strlen(str));
//printf(count %d\n,c);
return 1;
}
}
int main()
{
struct node* trie=createnode('$');
char str[1000];
int t,k;
scanf(%d,t);
while(t--)
{
scanf(%s,str);
trie=insert(str,0,strlen(str),trie);
}
scanf(%d,k);
for(int i=1;i=k;i++)
{
scanf(%s,str);
printf(Case #%d:\n,i);
if(!solve(str,0,strlen(str),trie))
printf(No match.\n);
}
return 0;
}

On Feb 15, 11:56 am, shady sinv...@gmail.com wrote:
 will TRIE be the best solution for this problem ?

 Linkhttp://www.spoj.pl/problems/DICT/

-- 
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: Adobe written test

2011-09-08 Thread pavan kumar
Thnx Amit...Can any one post some sample ques so that it vl be very useful
??

On Thu, Sep 8, 2011 at 11:41 AM, Amit Gupta amit070...@gmail.com wrote:

 Written test of adobe had 3 sections -
 Quant and Analytical section - 45 questions(30 + 15) 45 mins
 2 coding papers - 1 hr each , 10 ques each
 1st coding paper had general MCQ  (test ur c skills type )
 2nd coding paper had ques for writing algos, codes and few OS
 questions.

 --
 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:
---
K Pavan Kumar
Computer Science  Engg.
2nd Mtech, IIT Madras.

-- 
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] Adobe written test

2011-09-07 Thread pavan kumar
Can any one pls post the questions that were asked in Adobe written test ???
And also pattern of the paper
-- 



Regards:
---
K Pavan Kumar
Computer Science  Engg.
2nd Mtech, IIT Madras.

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