[algogeeks] OFF TOPIC(QUERY)

2012-02-05 Thread adarsh kumar
hi friends
I will be takng up amazon online test in a few days.
Can any1 temme wat r the areas to concentrate on for this,and for
their interviews?
It would be great if sum1 can provide some info regarding this.
regards,
adarsh.

-- 
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] OFF TOPIC(QUERY)

2012-02-05 Thread digcon9
Afair they appreciate service like design - so one if the advices learn
about SOAP. And basic CS is essential for all interviews.
05.02.2012 12:58 пользователь adarsh kumar algog...@gmail.com написал:

 hi friends
 I will be takng up amazon online test in a few days.
 Can any1 temme wat r the areas to concentrate on for this,and for
 their interviews?
 It would be great if sum1 can provide some info regarding this.
 regards,
 adarsh.

 --
 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] nyone having pointer in c ebook..plz mail me...

2012-02-05 Thread Veronica Sharma
i have pdf of  pointers on c by Kenneth A Reek...but its 144 MB, cant send
it on mail..

On Sat, Feb 4, 2012 at 4:33 PM, rahul sharma rahul23111...@gmail.comwrote:


  --
 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] nyone having pointer in c ebook..plz mail me...

2012-02-05 Thread saurabh singh
Kindly don't post more replies on this thread.This group is not for file
sharing.
Saurabh Singh
B.Tech (Computer Science)
MNNIT
blog:geekinessthecoolway.blogspot.com



On Sun, Feb 5, 2012 at 3:12 PM, Veronica Sharma
sharma.veron...@gmail.comwrote:

 i have pdf of  pointers on c by Kenneth A Reek...but its 144 MB, cant send
 it on mail..


 On Sat, Feb 4, 2012 at 4:33 PM, rahul sharma rahul23111...@gmail.comwrote:


  --
 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: Reverse Engg.

2012-02-05 Thread anshu mishra
awesome question :D :D

-- 
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] ORDERS

2012-02-05 Thread shady
Hi, Any hints for this problem ?
 Link http://www.codechef.com/problems/ORDERS/

-- 
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] In a char string, find min distance between 2 letters, O(n) time, O(1) space.

2012-02-05 Thread Ashish Goel
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652

-- 
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] In a char string, find min distance between 2 letters, O(n) time, O(1) space.

2012-02-05 Thread payal gupta
do u mean d min distance b/w two specific nos present in an array which may
have repeated ele's???
Regards,
PAYAL GUPTA,
NIT-B.

On Sun, Feb 5, 2012 at 7:51 PM, Ashish Goel ashg...@gmail.com wrote:





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

 --
 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] In a char string, find min distance between 2 letters, O(n) time, O(1) space.

2012-02-05 Thread Ashish Goel
eg

string is adcbeadabc

min distance between a,b is 1

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


On Sun, Feb 5, 2012 at 9:25 PM, payal gupta gpt.pa...@gmail.com wrote:

 do u mean d min distance b/w two specific nos present in an array which
 may have repeated ele's???
 Regards,
 PAYAL GUPTA,
 NIT-B.

 On Sun, Feb 5, 2012 at 7:51 PM, Ashish Goel ashg...@gmail.com wrote:





 Best Regards

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

 --
 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: In a char string, find min distance between 2 letters, O(n) time, O(1) space.

2012-02-05 Thread WgpShashank
@ashsih ..here is algo 

1st Traverse array from left side and stop if either *a* or *b *are found. 
Store index of this first occurrence in a variable say first then
Now traverse *array *after the index *first*. If the element at current 
index *i* matches with either x or y then check if it is different from *
arr[first]* that we have already found. If it is different then update the 
minimum distance so far we have traversed the array . If it is same then 
update *first * i.e., make *first = i*. 
repeat same again .

time complexity O(N) , space complexity O(1) 

Hope you can implement it :) Let me if other way exist to do the same or 
any flaw in approach ?

*Thanks
Shashank Mani Narayan
Computer Science  Engineering 
Birla Institute of Technology,Mesra 
** Founder Cracking The Code Lab  http://shashank7s.blogspot.com/*

-- 
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/-/MUpEZqJS1NcJ.
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] nyone having pointer in c ebook..plz mail me...

2012-02-05 Thread WgpShashank
@Saurabh People Can Ask for Free Materials until it violates copyright law 
, if someone has they can help each other through personal mail, there is 
nothing wrong in this .



*Thanks
Shashank Mani Narayan
Computer Science  Engineering 
Birla Institute of Technology,Mesra 
** Founder Cracking The Code Lab  http://shashank7s.blogspot.com/* 

-- 
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/-/_zZWqnR--hIJ.
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 ABCPATH

2012-02-05 Thread WgpShashank
@trinity tell the link of problem ?



*Thanks
Shashank Mani Narayan
Computer Science  Engineering 
Birla Institute of Technology,Mesra 
** Founder Cracking The Code Lab  http://shashank7s.blogspot.com/*

-- 
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/-/VhCj6Mr4ao0J.
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: Disjoint Set data structure

2012-02-05 Thread WgpShashank
@Karthik ..You Can Look  
http://en.wikipedia.org/wiki/Ackermann_function#Inverse


*Thanks
Shashank Mani Narayan
Computer Science  Engineering 
Birla Institute of Technology,Mesra 
** Founder Cracking The Code Lab  http://shashank7s.blogspot.com/*

-- 
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/-/jGHAVoQJ4SsJ.
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: Disjoint Set data structure

2012-02-05 Thread chirag ahuja
Shashank is right, if someone is in the need of some book, why do some
people here feel the need to post things like this is not a place for file
sharing and crap.. You can just ignore the mail, and let the person who
needs the book take help from others who are willing to help.

On Sun, Feb 5, 2012 at 11:33 PM, WgpShashank shashank7andr...@gmail.comwrote:

 @Karthik ..You Can Look
 http://en.wikipedia.org/wiki/Ackermann_function#Inverse


 *Thanks
 Shashank Mani Narayan
 Computer Science  Engineering
 Birla Institute of Technology,Mesra
 ** Founder Cracking The Code Lab  http://shashank7s.blogspot.com/*

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

 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] nyone having pointer in c ebook..plz mail me...

2012-02-05 Thread chirag ahuja
Shashank is right, if someone is in the need of some book, why do some
people here feel the need to post things like this is not a place for file
sharing and crap.. You can just ignore the mail, and let the person who
needs the book take help from others who are willing to help.

On Sun, Feb 5, 2012 at 11:15 PM, WgpShashank shashank7andr...@gmail.comwrote:

 @Saurabh People Can Ask for Free Materials until it violates copyright law
 , if someone has they can help each other through personal mail, there is
 nothing wrong in this .



 *Thanks
 Shashank Mani Narayan
 Computer Science  Engineering
 Birla Institute of Technology,Mesra
 ** Founder Cracking The Code Lab  http://shashank7s.blogspot.com/*

 --
 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/-/_zZWqnR--hIJ.

 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: Disjoint Set data structure

2012-02-05 Thread chirag ahuja
sorry, replied on wrong thread. :p

On Sun, Feb 5, 2012 at 11:42 PM, chirag ahuja sparkle.chi...@gmail.comwrote:

 Shashank is right, if someone is in the need of some book, why do some
 people here feel the need to post things like this is not a place for file
 sharing and crap.. You can just ignore the mail, and let the person who
 needs the book take help from others who are willing to help.


 On Sun, Feb 5, 2012 at 11:33 PM, WgpShashank 
 shashank7andr...@gmail.comwrote:

 @Karthik ..You Can Look
 http://en.wikipedia.org/wiki/Ackermann_function#Inverse


 *Thanks
 Shashank Mani Narayan
 Computer Science  Engineering
 Birla Institute of Technology,Mesra
 ** Founder Cracking The Code Lab  http://shashank7s.blogspot.com/*

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

 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: Spoj ABCPATH

2012-02-05 Thread saurabh singh
http://www.spoj.pl/problems/ABCPATH/
Saurabh Singh
B.Tech (Computer Science)
MNNIT
blog:geekinessthecoolway.blogspot.com



On Sun, Feb 5, 2012 at 11:18 PM, WgpShashank shashank7andr...@gmail.comwrote:

 @trinity tell the link of problem ?



 *Thanks
 Shashank Mani Narayan
 Computer Science  Engineering
 Birla Institute of Technology,Mesra
 ** Founder Cracking The Code Lab  http://shashank7s.blogspot.com/*

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

 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] openmp

2012-02-05 Thread Arun Vishwanathan
hi , i am trying to run this small code with open mp but I dont see any
threads created . The code compiles with -fopenmp but does not create
threads to run parallel.For example,

main()
{
  omp_set_num_threads(4);
 #pragma omp parallel
 printf( hello world from %d\n ,omp_get_thread_num());
return;

}
output: hello world from 0

what abt the other threads??
--

-- 
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: spell check

2012-02-05 Thread WgpShashank
@ravi .. why don't try with TRIE 




-- 
*Thanks
Shashank Mani Narayan
Computer Science  Engineering 
Birla Institute of Technology,Mesra 
** Founder Cracking The Code Lab  http://shashank7s.blogspot.com/*

-- 
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/-/O7OYXAdKBNYJ.
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] openmp

2012-02-05 Thread Rahul
which compiler
or which environment
I use Microsoft Visual Studio
with Microsoft HPC Pack
A syntax error is visible
use {


On 2/6/12, Arun Vishwanathan aaron.nar...@gmail.com wrote:
 hi , i am trying to run this small code with open mp but I dont see any
 threads created . The code compiles with -fopenmp but does not create
 threads to run parallel.For example,

 main()
 {
   omp_set_num_threads(4);
  #pragma omp parallel
  printf( hello world from %d\n ,omp_get_thread_num());
 return;

 }
 output: hello world from 0

 what abt the other threads??
 --

 --
 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] openmp

2012-02-05 Thread Arun Vishwanathan
I use g++

On Sun, Feb 5, 2012 at 12:39 PM, Rahul raikra...@gmail.com wrote:

 which compiler
 or which environment
 I use Microsoft Visual Studio
 with Microsoft HPC Pack
 A syntax error is visible
 use {


 On 2/6/12, Arun Vishwanathan aaron.nar...@gmail.com wrote:
  hi , i am trying to run this small code with open mp but I dont see any
  threads created . The code compiles with -fopenmp but does not create
  threads to run parallel.For example,
 
  main()
  {
omp_set_num_threads(4);
   #pragma omp parallel
   printf( hello world from %d\n ,omp_get_thread_num());
  return;
 
  }
  output: hello world from 0
 
  what abt the other threads??
  --
 
  --
  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.




-- 
 People often say that motivation doesn't last. Well, neither does bathing
- that's why we recommend it daily.

-- 
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] openmp

2012-02-05 Thread Rahul
See a hello world tutorial
as far as I can see is that
you haven't put {}
in the section of code you want to run parallel
how many processors do you have
try running without asking number of threads
.you must see as many outputs as number of processors


On 2/6/12, Arun Vishwanathan aaron.nar...@gmail.com wrote:
 I use g++

 On Sun, Feb 5, 2012 at 12:39 PM, Rahul raikra...@gmail.com wrote:

 which compiler
 or which environment
 I use Microsoft Visual Studio
 with Microsoft HPC Pack
 A syntax error is visible
 use {


 On 2/6/12, Arun Vishwanathan aaron.nar...@gmail.com wrote:
  hi , i am trying to run this small code with open mp but I dont see any
  threads created . The code compiles with -fopenmp but does not create
  threads to run parallel.For example,
 
  main()
  {
omp_set_num_threads(4);
   #pragma omp parallel
   printf( hello world from %d\n ,omp_get_thread_num());
  return;
 
  }
  output: hello world from 0
 
  what abt the other threads??
  --
 
  --
  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.




 --
  People often say that motivation doesn't last. Well, neither does bathing
 - that's why we recommend it daily.

 --
 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] openmp

2012-02-05 Thread Arun Vishwanathan
hey , I just figured out the problem. the -fopenmp was to be included in a
couple of places in my makefile due to which the openmp library was not
getting recognised though code was compiling.
Anyways if it is just one line of code and  u dont need the braces after
omp parallel( it is just like a one line statement after 'if')
i have dual core.
thanks for yr help!

On Sun, Feb 5, 2012 at 12:49 PM, Rahul raikra...@gmail.com wrote:

 See a hello world tutorial
 as far as I can see is that
 you haven't put {}
 in the section of code you want to run parallel
 how many processors do you have
 try running without asking number of threads
 .you must see as many outputs as number of processors


 On 2/6/12, Arun Vishwanathan aaron.nar...@gmail.com wrote:
  I use g++
 
  On Sun, Feb 5, 2012 at 12:39 PM, Rahul raikra...@gmail.com wrote:
 
  which compiler
  or which environment
  I use Microsoft Visual Studio
  with Microsoft HPC Pack
  A syntax error is visible
  use {
 
 
  On 2/6/12, Arun Vishwanathan aaron.nar...@gmail.com wrote:
   hi , i am trying to run this small code with open mp but I dont see
 any
   threads created . The code compiles with -fopenmp but does not create
   threads to run parallel.For example,
  
   main()
   {
 omp_set_num_threads(4);
#pragma omp parallel
printf( hello world from %d\n ,omp_get_thread_num());
   return;
  
   }
   output: hello world from 0
  
   what abt the other threads??
   --
  
   --
   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.
 
 
 
 
  --
   People often say that motivation doesn't last. Well, neither does
 bathing
  - that's why we recommend it daily.
 
  --
  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.




-- 
 People often say that motivation doesn't last. Well, neither does bathing
- that's why we recommend it daily.

-- 
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: doubt about macro.......

2012-02-05 Thread Dave
@Sharad: Wouldn't it expand into

int t; t=t;t=u;u=t

with unexpected results?

Also, won't

swap(i,j,int)
swap(x,y,double)

cause trouble? It will expand into

int t; t=i; i=j; j=t;
double t; t=x; x=y; y=t;

which gives conflicting types for t. But there is a way to fix this,
isn't there?

Dave

On Feb 4, 1:26 pm, sharad dixit sharad.emine...@gmail.com wrote:
 @dave i am not very much clear about your question .But i support my
 previous comment 
 widhttp://publib.boulder.ibm.com/infocenter/comphelp/v7v91/index.jsp?top...





 On Sat, Feb 4, 2012 at 12:25 PM, Dave dave_and_da...@juno.com wrote:
  @Sharad: So what does swap(t,u,int) do?

  Dave

  On Feb 4, 5:10 am, sharad dixit sharad.emine...@gmail.com wrote:
   Think #define as a simple text substitution macro.

   Assume you are the preprocessor. Copy/paste the exact code for the macro
   into the places where your program tried to use and then replace the
  macro
   parameters with the arguments that you used to invoke the macro.

   The advantage of a macro is that it can be type-neutral (also
  disadvantage
   sometimes ), and it is inlined directly into the code, so there is not
   any
   function call overhead.

   correct me if am wrong :D

   On Sat, Feb 4, 2012 at 5:32 AM, rahul sharma rahul23111...@gmail.com
  wrote:

swap(a,b,c) c t;t=a;a=b;b=t;

int main()
{
int g=1,h=2;
swap(g,h,int);
}

how the actual values are replace???
a and b are replaced with g and hactual are replace..can somebody
  tell
me expanded source code???

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

   --
    Sharad Dixit
    B.Tech(IT)
    Indian Institute of Information Technology ,Allahabad

  ---­­--
   We aim above the mark to hit the mark.
   ~ Ralph Waldo Emerson

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

 --
  Sharad Dixit
  B.Tech(IT)
  Indian Institute of Information Technology ,Allahabad
 ---­--
 We aim above the mark to hit the mark.
 ~ Ralph Waldo Emerson

-- 
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: In a char string, find min distance between 2 letters, O(n) time, O(1) space.

2012-02-05 Thread Harshal
Initialize
i = index of first 'a'
j = index of first 'b'
n = array length.
MinDist = n+1;


while(i  n  j  n){
  MinDist = min(MinDist, abs(i-j))
  if(i  j)
i = index of next 'a'
  else
j = index of next 'b'
}

-- 
Best Regards,
Harshal Choudhary.

-- 
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: spell check

2012-02-05 Thread atul anand
@*Shashank : *i guess using TRIE for spell check is not a good option
because
1) dictionary is too large , it would take lot of time for creating trie
for all word in the dictionary.
2) space consumption will be too large . there are algorithmn in which we
can optimize space but still it would take lot of space.
3) TRIE will not give you closet match to the give input, it just give you
say n number of the matching pair. those n match may not be the closest one.
5) what if 1st alphabet of the given input is wrong ,Trie will traverse
wrong branch.
4) creating trie  and traversing to find all combination is kinda
messyi guess

On Mon, Feb 6, 2012 at 1:45 AM, WgpShashank shashank7andr...@gmail.comwrote:

 @ravi .. why don't try with TRIE




 --
 *Thanks
 Shashank Mani Narayan
 Computer Science  Engineering
 Birla Institute of Technology,Mesra
 ** Founder Cracking The Code Lab  http://shashank7s.blogspot.com/*

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

 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: JAVA: Print all paths from root to leaf

2012-02-05 Thread atul anand
@WgpShashank:  actually linked list is a good choice if  tree height is
large.Array may not able to fill it.

-- 
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: In a char string, find min distance between 2 letters, O(n) time, O(1) space.

2012-02-05 Thread Ashish Goel
This is what i had thought of too, btw, we need to update first in all
cases whether the char is same as a previous one or different.

int minD(char *pStr, int len, char a, char b)
{
  if ((!pStr)|| (len 2)) return -1;
  if (a == b) return 0;
  bool foundA=false;
  bool foundB=false;
  int startIndex = -1;
  int minD=INT_MAX;

  while(pStr[i] !='\0')
  {
if (*pStr == a)
{
  if (foundA) //already found A
  {  startIndex = i; }
  else if (foundB)
  {  minD = min(minD, i-startIndex-1); foundB = false;foundA = true;
startIndex = i; }
}
   else (*pStr == b)
   {
  if (foundB) //already found B
  {  startIndex = i; }
  else if (foundA)
  {  minD = min(minD, i-startIndex-1); foundA = false;foundB = true;
startIndex = i; }
   }
   i++;
  }
  if (minD length) return -1;
  return minD;
}




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


On Sun, Feb 5, 2012 at 11:13 PM, WgpShashank shashank7andr...@gmail.comwrote:

 @ashsih ..here is algo

 1st Traverse array from left side and stop if either *a* or *b *are
 found. Store index of this first occurrence in a variable say first then
 Now traverse *array *after the index *first*. If the element at current
 index *i* matches with either x or y then check if it is different from *
 arr[first]* that we have already found. If it is different then update
 the minimum distance so far we have traversed the array . If it is same
 then update *first * i.e., make *first = i*.
 repeat same again .

 time complexity O(N) , space complexity O(1)

 Hope you can implement it :) Let me if other way exist to do the same or
 any flaw in approach ?

 *Thanks
 Shashank Mani Narayan
 Computer Science  Engineering
 Birla Institute of Technology,Mesra
 ** Founder Cracking The Code Lab  http://shashank7s.blogspot.com/*

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

 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: In a char string, find min distance between 2 letters, O(n) time, O(1) space.

2012-02-05 Thread WgpShashank
@harsahl that won't work in duplicate case :)

@ashish ..my will produce correct result , no need of using extra variable 


here is main function i am talking about 

int minDist(char arr[], int n, char x, char y)
{
   int i = 0;
   int min_dist = INT_MAX;
   int first;
 
   // Find the first occurence of any of the two numbers (x or y)
   // and store the index of this occurence in prev
   for (i = 0; i  n; i++)
   {
 if (arr[i] == x || arr[i] == y)
 {
   first= i;
   break;
 }
   }
 
   // Traverse after the first occurence
   for ( ; i  n; i++)
   {
  if (arr[i] == x || arr[i] == y)
  {
  // If the current element matches with any of the two then
  // check if current element and prev element are different
  // Also check if this value is smaller than minimm distance so far
  if ( arr[first] != arr[i]  (i - first)  min_dist )
  {
 min_dist = i - first;
 first= i;
  }
  else
 first = i;
  }
   }
 
   return min_dist;
}
 

correct me if anything wrong ?



*Thanks
Shashank Mani Narayan
Computer Science  Engineering 
Birla Institute of Technology,Mesra 
** Founder Cracking The Code Lab  http://shashank7s.blogspot.com/*
  
 

-- 
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/-/8jtKYhSvwYQJ.
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: In a char string, find min distance between 2 letters, O(n) time, O(1) space.

2012-02-05 Thread atul anand
@WgpShashank : for which test case harsahl soln will fail???

On Mon, Feb 6, 2012 at 11:02 AM, WgpShashank shashank7andr...@gmail.comwrote:

 @harsahl that won't work in duplicate case :)

 @ashish ..my will produce correct result , no need of using extra variable


 here is main function i am talking about

 int minDist(char arr[], int n, char x, char y)
 {
int i = 0;
int min_dist = INT_MAX;
int first;

// Find the first occurence of any of the two numbers (x or y)
// and store the index of this occurence in prev
for (i = 0; i  n; i++)
{
  if (arr[i] == x || arr[i] == y)
  {
first= i;
break;
  }
}

// Traverse after the first occurence
for ( ; i  n; i++)
{
   if (arr[i] == x || arr[i] == y)
   {
   // If the current element matches with any of the two then
   // check if current element and prev element are different
   // Also check if this value is smaller than minimm distance so
 far
   if ( arr[first] != arr[i]  (i - first)  min_dist )
   {
  min_dist = i - first;
  first= i;
   }
   else
  first = i;
   }
}

return min_dist;
 }


 correct me if anything wrong ?




 *Thanks
 Shashank Mani Narayan
 Computer Science  Engineering
 Birla Institute of Technology,Mesra
 ** Founder Cracking The Code Lab  http://shashank7s.blogspot.com/*


  --
 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/-/8jtKYhSvwYQJ.

 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: Pairwise Sum Array

2012-02-05 Thread sandipan
Hello Ashish, try with this 2-5-6-8-11

so, if we do this then pair wise sum will be

(7-8-10-13) | (11-13-16) | (14 17) | (19)

So the last three elements will be (16-17-19)

Here, 16 is b+e

So,it is not necessary that the last three elements will be exactly
1.c+d
2.c+e
3.d+e

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