Re: [algogeeks] Casual: MS in US expenses

2013-06-25 Thread Shachin Sharma
Most of the good/top universities will have many TA and RA positions.
Besides this University associated institutes provide RAs. As far as my
experience goes almost all of the computer science MS students got RA or TA
which covers for 75% waiver in tuition and like 1100 to 1500 $ money, which
covered the expenses. But this may not be true for all the universities and
you might want to ask specfically for the program you are applying.

Regards,
Shachin


On Tue, Jun 25, 2013 at 4:49 PM, Jagannath Prasad Das
jpdasi...@gmail.comwrote:

 Folks,
I suppose this is not the right blog to query about the aforementioned
 subject, but i am of opinion that i can get a comprehensive reply to my
 question. On an average how much money(approx) does it take somebody to do
 a MS in US(including tution,hostel and miscellaneous) ?

 I suppose it is easy to get a RA in the university you study and that
 helps in someway.

 Regards,
 Jagannath

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to algogeeks+unsubscr...@googlegroups.com.




-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.




Re: [algogeeks] Fwd: anu_test Segmentation fault

2011-07-03 Thread Shachin Sharma
You might want to try the following:

limit

This will show you the stacksize limit (I believe 1024 KB?)

Execute the following command

unlimit stacksize

This should increase the stacksize and make the program work. The second
thing is I agree with the fact the such huge static allocation shouldnt be
done and it would be better to allocate this chunk dynamically.

Regards,
Shachin

On Sun, Jul 3, 2011 at 9:26 PM, Vishal Thanki vishaltha...@gmail.comwrote:

 Don't allocate too much static memory in stack, it will cause
 troubles. You are doing int[2000][2000], i.e. 2000*2000*4 bytes of
 memory in stack. Use dynamic memory allocation for such large chunk. I
 modified your code as below and it doesn't give seg fault.
 #includestdio.h
 #include malloc.h
 #includestring.h
 #define MAX 2000
 using namespace std;

 int minimum(int a,int b,int c)
 {
if(ab  ac) return a;
if(bc) return b;
return c;
 }

 int LevenshteinDistance(char *a, char *b)
 {
 int **d;
 int m=0,n=0,i,j;
char s[MAX]=0;
char t[MAX]=0;
 d = (int **)malloc(MAX*sizeof(int));
for (i=0;iMAX;i++)
d[i] = (int *)malloc(MAX*sizeof(int));
 strcat(s,a);
strcat(t,b);
m=strlen(s);
n=strlen(t);
printf(%s%s,s,t);
for(i=0;i=m;i++) d[i][0]=i ;
for(j=0;j=n;j++) d[0][j]=j;

for(j=1;j=n;j++)
{
for(i=1;i=m;i++)
{
if (s[i] == t[j])
d[i][j]=d[i-1][j-1];
else
d[i][j]=minimum(d[i-1][j] +
 (s[i]==t[i]?0:1),d[i][j-1] +
 1,d[i-1][j-1] + 1 );
}

}
 //TODO: Free d
 return d[m][n];
 }


 int main()
 {
int t,ed;
char s1[MAX],t1[MAX];
scanf(%d,t);
while( t--)
{
scanf(%s%s,s1,t1);
//couts1t1endl;
ed=LevenshteinDistance(s1,t1);
printf(%d\n,ed);
}

return 0;
 }


 On Sun, Jul 3, 2011 at 9:08 PM, HARSH PAHUJA hpahuja.mn...@gmail.com
 wrote:
 
 
  -- Forwarded message --
  From: HARSH PAHUJA hpahuja.mn...@gmail.com
  Date: Sun, Jul 3, 2011 at 8:37 AM
  Subject: anu_test Segmentation fault
  To: anutest...@googlegroups.com
 
 
  http://www.ideone.com/QuMcn
  plzz help.
  y the above program is giving seg fault
 
  #includestdio.h
  #includestring.h
  #define MAX 2000
  //using namespace std;
  int minimum(int a,int b,int c)
  {
  if(ab  ac) return a;
  if(bc) return b;
  return c;
  }
  int LevenshteinDistance(char a[], char b[])
  {
  int d[2000][2000]={0};
  int m=0,n=0,i,j;
  char s[MAX]=0;
  char t[MAX]=0;
  strcat(s,a);
  strcat(t,b);
  m=strlen(s);
  n=strlen(t);
  printf(%s%s,s,t);
  for(i=0;i=m;i++) d[i][0]=i ;
  for(j=0;j=n;j++) d[0][j]=j;
  for(j=1;j=n;j++)
  {
  for(i=1;i=m;i++)
  {
  if (s[i] == t[j])
  d[i][j]=d[i-1][j-1];
  else
  d[i][j]=minimum(d[i-1][j] + (s[i]==t[i]?0:1),d[i][j-1] + 1,d[i-1][j-1] +
 1
  );
  }
  }
  return d[m][n];
  }
 
  int main()
  {
  int t,ed;
  char s1[MAX],t1[MAX];
  scanf(%d,t);
  while( t--)
  {
  scanf(%s%s,s1,t1);
  //couts1t1endl;
  ed=LevenshteinDistance(s1,t1);
  printf(%d\n,ed);
  }
  return 0;
  }
 
  --
  You received this message because you are subscribed to the Google Groups
  anu testing group.
  To post to this group, send email to anutest...@googlegroups.com.
  To unsubscribe from this group, send email to
  anutesting+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/anutesting?hl=en.
 
 
 
  --
  HARSHIT PAHUJA
  M.N.N.I.T.
  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.



-- 
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 Looping Node

2011-01-14 Thread Shachin Sharma
@ snehal I have a doubt. Are you sure this will terminate and find the
looping node?

slow1=head;
 while( slow1!=slow)
{
prev=slow;
slow=slow-next;
slow1=slow1-next;

}

Consider this example list with nodes 1-12 looping node 5.

1  2  3  4  5  6   7  8 -
   |  |
12  11  10  9

Initially
slow is at 6
and slow1 is at 1

after 7moves slow comes at 5 while slow1 at  8 (they don't meet so far). Now
will the above code will slow and slow1 ever meet once both of them are
traversing the loop with single moves?

May be I am not getting this correctly please explain if I havent understood
it fully?


On Thu, Jan 13, 2011 at 5:20 PM, snehal jain learner@gmail.com wrote:

 @ above

 your code is only detecting loop.. my code is detecting loop and then
 removing loop as well


 On Thu, Jan 13, 2011 at 5:04 PM, bittu shashank7andr...@gmail.com wrote:

 @snehal ..although ur approach ir good but u make d problem little
 complex,also missed out little checking, it can be done by using 2
 pointers   single while loop--Now Instruction(CPU) Matters.

 Rather then presenting different-2 algorithm i will present very
 famous algorithm Floyd’s Cycle-Finding Algorithm:

 it is the fastest method. Traverse linked list using two pointers.
 Move one pointer by one and other pointer by two.  If these pointers
 meet at some node then there is a loop.  If pointers do not meet then
 linked list doesn’t have loop.

 Time complexity O(n)
 Space Complexity O(1)


 Code-Snippet  Below

 int is_loop(struct node *list)
 {
  struct node  *slow_p = list, *fast_p = list;

  while(slow_p  fast_p 
  slow_p-next 
  fast_p-next 
  fast_p-next-next )
  {
slow_p = slow_p-next;
fast_p  = fast_p-next-next;
if (slow_p == fast_p)
{
   printf(Found Loop);
   return 1;
}
  }
  return 0;
 }


 It Will Surely Works.


 Regards
 Shashank Mani Don't b Evil U Can Learn whilw U Earn

 --
 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.comalgogeeks%2bunsubscr...@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.comalgogeeks%2bunsubscr...@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: another google telephone interview question

2010-05-20 Thread Shachin Sharma
Hi Jagdish,

I think your solution looks good. The only thing about extra space to store
count can be dealt with like this in my view:

1) Do a scan of numbers and determine the max number.

2) Create a max heap (Root is the largest number so by step 1 we have
determined the Root for the heap).

3) Whenever a number repeats instead of storing the count store modify the
number to (number + ROOT Value) ie for 2 which is repeated twice 2 + 3 +3  =
8 instead of 2:3 as you give in your example.

4) Since in a heap no number can be greater than root value whenever a
number greater than ROOT (here 3) is accessed/encountered we know the
frequency by subtracting till the number is  root value. For example when
you see 8 subtract value 3 till number is less than 3. Which means 8-3-3 or
frequency =2 for the number. Number of subtractions is the frequency of
occurrence. So we don't need extra space to determine frequency but with
some extra computation can determine the count at runtime. There can be
better ways than addition but you get the basic idea of not using any extra
space O(k).

What do you think? Personally I feel space isn't that big a issue specially
if its linear but interviewer is the boss ;-)

Regards,
Sachin


On Tue, May 18, 2010 at 7:01 PM, Jagadish M jagadis...@gmail.com wrote:


 On May 18, 8:29 am, Terence technic@gmail.com wrote:
  How do you maintain the heap? Could you explain in detail for the
  following example:
  1 2 3 3 2 1 1 1 2 3 (n=10, k=3)

 Basically, in each node we maintain the key and its count.

 Initially, heap has the first element.
 1:1

 Search for 2 and insert( since its not found)
  1:1
  /
 2:1

 Search for 3 and insert ( since its not found).

1:1
  /   \
 2:13:1

 Search for 3; since 3 is already there increment its count by 1.

1:1
  /   \
 2:13:2

 Search for 2; since 2 is already there increment its count by 1.

1:1
  /   \
 2:23:2

 and so on...


 Since, there are only k distinct keys the heap size will at most be k;
 so each search/insert/increment operation takes O(log k) time.


 Jagadish
 http://www.cse.iitb.ac.in/~jagadish



 
  On 2010-5-17 22:38, Jagadish M wrote:
 
 
 
   The best algorithm I can think of is to maintain a heap of k elements.
   Takes O(n log k) time.
   Is anything told about the values of the keys? If the keys have values
   less than N, then it is possible to do
   what you say, i.e sort them in place.
 
   -Jagadish
  http://www.cse.iitb.ac.in/~jagadish
 
   On May 13, 7:06 pm, divyasweetdivya@gmail.com  wrote:
 
   This problem was asked in google phone interview. We have N element
   array with k distinct keys(No relation between k  N given so assume
   kN)
   What is the best method to sort this array without using any extra
   memory? Please elaborate.
 
   --
   You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
   To post to this group, send email to algoge...@googlegroups.com.
   To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
   For more options, visit this group athttp://
 groups.google.com/group/algogeeks?hl=en.
 
  --
  You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
  To post to this group, send email to algoge...@googlegroups.com.
  To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
  For more options, visit this group athttp://
 groups.google.com/group/algogeeks?hl=en.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.