[algogeeks] Improve data store for this particular Code Chef problem to improve performance in time

2013-07-09 Thread abhishek sharma
 Given *N* integers *A1, A2, …. AN*, Dexter wants to know how many ways he
can choose three numbers such that they are three consecutive terms of an
arithmetic progression.

Meaning that, how many triplets *(i, j, k)* are there such that *1 ≤ i  j
 k ≤ N* and *Aj - Ai = Ak - Aj*.

So the triplets (2, 5, 8), (10, 8, 6), (3, 3, 3) are valid as they are
three consecutive terms of an arithmetic progression. But the triplets (2,
5, 7), (10, 6, 8) are not.
Input

First line of the input contains an integer *N (3 ≤ N ≤ 10)*. Then the
following line contains *N* space separated integers *A1, A2, …, AN* and
they have values between *1* and *3* (inclusive).
Output

Output the number of ways to choose a triplet such that they are three
consecutive terms of an arithmetic progression.
Example

*Input:*
10
3 5 3 6 3 4 10 4 5 2
*Output:*
9

*I am attaching my solution..* I reached this solution after improving
the performance 10 times.. but it is still not accepted as the time
limit exceeds 3 seconds.

Can anyone please please suggest how to improve this ...
(I do not want a different approach .. I want to improve my approach)

PS: This is a practice problem .. So I am not cheating :)


-- 
Nice Day

Abhishek Sharma
Bachelor of Technology
IIT Kanpur (2009)

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




APTripletInStream.java
Description: Binary data


Re: [algogeeks] Improve data store for this particular Code Chef problem to improve performance in time

2013-07-09 Thread abhishek sharma
@Tian tanx


On Tue, Jul 9, 2013 at 5:55 PM, abhishek sharma abhishek.p...@gmail.comwrote:

 Okay let me explain my approach -

 1. Read numbers from the input stream and create an array of lists.. i
 started with hashmaps and hashsets etc .. but they greatly killed
 performance

 2. Each index in the array holds the positions of that particular index(in
 the stream) in a list..(I simply insert these positions in the list at
 array[index]..)

 3. Any such list (at any index in the array) is sorted at any given point
 of time since the positions are only going to increase as we keep reading
 input from stream..

 4. Once the input is read, iterate over this data store in the following
 manner -

 Let result holds the answer

 for i: 1 to 31 // Loop A
 if(array[i].size  2)
 result += S(S-1)(S-2)/6
 for(j: 2*i-1 to i+1)
  listRight = array[j]
  listLeft = array[i - (j-i)]
  for int x: array[i]
  //use Collections.binarySearch
  a = number of elements greater than x in listRight
  c = listRight.size - a
  b =  number of elements less than x in listLeft
  d = listLeft.Size - b
  result += a*b
  result += c*d// Explanation E

  return result once Loop A is done..

 E = Suppose 6,.,4.,2 occur in the stream as well as 2...,4...,6 ..
 I need to capture both these as they both form an AP

 To improve time, it is recommended(on CodeChef, it uses SPOJ) to use
 BufferedReader when reading long inputs from console.. Hence I am using
 that ..

 My SkypeID: abhishekpc87iit.. Feel free to contact me .. always online..


 On Tue, Jul 9, 2013 at 5:32 PM, Tian Guo tian@epfl.ch wrote:

 Can you just briefly describe your algorithm and time complexity? Then we
 could know the problem and think about from which perspective to improve it.

 Thx!


 2013/7/9 abhishek sharma abhishek.p...@gmail.com


  Given *N* integers *A1, A2, …. AN*, Dexter wants to know how many ways
 he can choose three numbers such that they are three consecutive terms of
 an arithmetic progression.

 Meaning that, how many triplets *(i, j, k)* are there such that *1 ≤ i
  j  k ≤ N* and *Aj - Ai = Ak - Aj*.

 So the triplets (2, 5, 8), (10, 8, 6), (3, 3, 3) are valid as they are
 three consecutive terms of an arithmetic progression. But the triplets (2,
 5, 7), (10, 6, 8) are not.
 Input

 First line of the input contains an integer *N (3 ≤ N ≤ 10)*. Then
 the following line contains *N* space separated integers *A1, A2, …, AN*and 
 they have values between
 *1* and *3* (inclusive).
 Output

 Output the number of ways to choose a triplet such that they are three
 consecutive terms of an arithmetic progression.
 Example

 *Input:*
 10
 3 5 3 6 3 4 10 4 5 2
 *Output:*
 9

 *I am attaching my solution..* I reached this solution after improving the 
 performance 10 times.. but it is still not accepted as the time limit 
 exceeds 3 seconds.



 Can anyone please please suggest how to improve this ...
 (I do not want a different approach .. I want to improve my approach)

 PS: This is a practice problem .. So I am not cheating :)


 --
 Nice Day

 Abhishek Sharma
 Bachelor of Technology
 IIT Kanpur (2009)

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






 --
 Nice Day

 Abhishek Sharma
 Bachelor of Technology
 IIT Kanpur (2009)




-- 
Nice Day

Abhishek Sharma
Bachelor of Technology
IIT Kanpur (2009)

-- 
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] Improve data store for this particular Code Chef problem to improve performance in time

2013-07-09 Thread abhishek sharma
Okay let me explain my approach -

1. Read numbers from the input stream and create an array of lists.. i
started with hashmaps and hashsets etc .. but they greatly killed
performance

2. Each index in the array holds the positions of that particular index(in
the stream) in a list..(I simply insert these positions in the list at
array[index]..)

3. Any such list (at any index in the array) is sorted at any given point
of time since the positions are only going to increase as we keep reading
input from stream..

4. Once the input is read, iterate over this data store in the following
manner -

Let result holds the answer

for i: 1 to 31 // Loop A
if(array[i].size  2)
result += S(S-1)(S-2)/6
for(j: 2*i-1 to i+1)
 listRight = array[j]
 listLeft = array[i - (j-i)]
 for int x: array[i]
 //use Collections.binarySearch
 a = number of elements greater than x in listRight
 c = listRight.size - a
 b =  number of elements less than x in listLeft
 d = listLeft.Size - b
 result += a*b
 result += c*d// Explanation E

return result once Loop A is done..

E = Suppose 6,.,4.,2 occur in the stream as well as 2...,4...,6 ..
I need to capture both these as they both form an AP

To improve time, it is recommended(on CodeChef, it uses SPOJ) to use
BufferedReader when reading long inputs from console.. Hence I am using
that ..

My SkypeID: abhishekpc87iit.. Feel free to contact me .. always online..


On Tue, Jul 9, 2013 at 5:32 PM, Tian Guo tian@epfl.ch wrote:

 Can you just briefly describe your algorithm and time complexity? Then we
 could know the problem and think about from which perspective to improve it.

 Thx!


 2013/7/9 abhishek sharma abhishek.p...@gmail.com


  Given *N* integers *A1, A2, …. AN*, Dexter wants to know how many ways
 he can choose three numbers such that they are three consecutive terms of
 an arithmetic progression.

 Meaning that, how many triplets *(i, j, k)* are there such that *1 ≤ i 
 j  k ≤ N* and *Aj - Ai = Ak - Aj*.

 So the triplets (2, 5, 8), (10, 8, 6), (3, 3, 3) are valid as they are
 three consecutive terms of an arithmetic progression. But the triplets (2,
 5, 7), (10, 6, 8) are not.
 Input

 First line of the input contains an integer *N (3 ≤ N ≤ 10)*. Then
 the following line contains *N* space separated integers *A1, A2, …, AN*and 
 they have values between
 *1* and *3* (inclusive).
 Output

 Output the number of ways to choose a triplet such that they are three
 consecutive terms of an arithmetic progression.
 Example

 *Input:*
 10
 3 5 3 6 3 4 10 4 5 2
 *Output:*
 9

 *I am attaching my solution..* I reached this solution after improving the 
 performance 10 times.. but it is still not accepted as the time limit 
 exceeds 3 seconds.


 Can anyone please please suggest how to improve this ...
 (I do not want a different approach .. I want to improve my approach)

 PS: This is a practice problem .. So I am not cheating :)


 --
 Nice Day

 Abhishek Sharma
 Bachelor of Technology
 IIT Kanpur (2009)

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






-- 
Nice Day

Abhishek Sharma
Bachelor of Technology
IIT Kanpur (2009)

-- 
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] Improve data store for this particular Code Chef problem to improve performance in time

2013-07-09 Thread abhishek sharma
Here is the link to problem - http://www.codechef.com/problems/COUNTARI

You can see my many unsuccessful attempts in All Submissions..

Ppl with successful submission have used a superb way to just use arrays to
solve this.. I hate those einsteins!


On Tue, Jul 9, 2013 at 5:56 PM, abhishek sharma abhishek.p...@gmail.comwrote:

 @Tian tanx


 On Tue, Jul 9, 2013 at 5:55 PM, abhishek sharma 
 abhishek.p...@gmail.comwrote:

 Okay let me explain my approach -

 1. Read numbers from the input stream and create an array of lists.. i
 started with hashmaps and hashsets etc .. but they greatly killed
 performance

 2. Each index in the array holds the positions of that particular
 index(in the stream) in a list..(I simply insert these positions in the
 list at array[index]..)

 3. Any such list (at any index in the array) is sorted at any given point
 of time since the positions are only going to increase as we keep reading
 input from stream..

 4. Once the input is read, iterate over this data store in the following
 manner -

 Let result holds the answer

 for i: 1 to 31 // Loop A
 if(array[i].size  2)
 result += S(S-1)(S-2)/6
 for(j: 2*i-1 to i+1)
  listRight = array[j]
  listLeft = array[i - (j-i)]
  for int x: array[i]
  //use Collections.binarySearch
  a = number of elements greater than x in listRight
  c = listRight.size - a
  b =  number of elements less than x in listLeft
  d = listLeft.Size - b
  result += a*b
  result += c*d// Explanation E

  return result once Loop A is done..

 E = Suppose 6,.,4.,2 occur in the stream as well as 2...,4...,6
 .. I need to capture both these as they both form an AP

 To improve time, it is recommended(on CodeChef, it uses SPOJ) to use
 BufferedReader when reading long inputs from console.. Hence I am using
 that ..

 My SkypeID: abhishekpc87iit.. Feel free to contact me .. always online..


 On Tue, Jul 9, 2013 at 5:32 PM, Tian Guo tian@epfl.ch wrote:

 Can you just briefly describe your algorithm and time complexity? Then
 we could know the problem and think about from which perspective to improve
 it.

 Thx!


 2013/7/9 abhishek sharma abhishek.p...@gmail.com


  Given *N* integers *A1, A2, …. AN*, Dexter wants to know how many
 ways he can choose three numbers such that they are three consecutive terms
 of an arithmetic progression.

 Meaning that, how many triplets *(i, j, k)* are there such that *1 ≤ i
  j  k ≤ N* and *Aj - Ai = Ak - Aj*.

 So the triplets (2, 5, 8), (10, 8, 6), (3, 3, 3) are valid as they are
 three consecutive terms of an arithmetic progression. But the triplets (2,
 5, 7), (10, 6, 8) are not.
 Input

 First line of the input contains an integer *N (3 ≤ N ≤ 10)*. Then
 the following line contains *N* space separated integers *A1, A2, …, AN
 * and they have values between *1* and *3* (inclusive).
 Output

 Output the number of ways to choose a triplet such that they are three
 consecutive terms of an arithmetic progression.
 Example

 *Input:*
 10
 3 5 3 6 3 4 10 4 5 2
 *Output:*
 9

 *I am attaching my solution..* I reached this solution after improving the 
 performance 10 times.. but it is still not accepted as the time limit 
 exceeds 3 seconds.




 Can anyone please please suggest how to improve this ...
 (I do not want a different approach .. I want to improve my approach)

 PS: This is a practice problem .. So I am not cheating :)


 --
 Nice Day

 Abhishek Sharma
 Bachelor of Technology
 IIT Kanpur (2009)

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






 --
 Nice Day

 Abhishek Sharma
 Bachelor of Technology
 IIT Kanpur (2009)




 --
 Nice Day

 Abhishek Sharma
 Bachelor of Technology
 IIT Kanpur (2009)




-- 
Nice Day

Abhishek Sharma
Bachelor of Technology
IIT Kanpur (2009)

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




[algogeeks] Re: Amazon Job openings

2013-01-15 Thread Abhishek
Are these openings for present final year students(2013 batch) as well???

regards
Abhishek

On Tuesday, 15 January 2013 16:47:01 UTC+5:30, sahil madaan wrote:

 Hi all,

 There are multiple openings for SDE1 and SDE2 for Amazon hyderabad and 
 Bangalore location. Interested candidates please send your resume to 
 sahilma...@gmail.com javascript:

 Thanks
 sahil


-- 




Re: [algogeeks] Skyline extraction

2013-01-03 Thread Abhishek Jha
i hope this helps

cseweb.ucsd.edu/classes/sp04/cse101/*skyline*.pdf


On Thu, Jan 3, 2013 at 10:09 PM, bharat b bagana.bharatku...@gmail.comwrote:

 I tried in google .. I didn't get better than O(n^2) algo. But in Adobe
 interview, I faced the same question, he expected better than O(n^2) algo.
 Can anyone give better algo for this.

 On Sat, Dec 29, 2012 at 3:07 AM, Abhishek Jha abbi031...@gmail.comwrote:

 Google skyline problem and you will find results for solving it with heap


 On Sat, Dec 29, 2012 at 1:49 AM, shady sinv...@gmail.com wrote:

 How to extract the skyline from the rectangles ?
 Given a set of rectangles with x coordinates and height, how to find the
 skyline ?

  --




  --




  --




-- 




Re: [algogeeks] Skyline extraction

2013-01-01 Thread Abhishek Jha
Google skyline problem and you will find results for solving it with heap


On Sat, Dec 29, 2012 at 1:49 AM, shady sinv...@gmail.com wrote:

 How to extract the skyline from the rectangles ?
 Given a set of rectangles with x coordinates and height, how to find the
 skyline ?

  --




-- 




Re: [algogeeks] swap objects without temp variable

2012-11-05 Thread Abhishek Jha
yep its right.one mre method will be

a=a+b;
b=a-b;
a=a-b;



On Mon, Nov 5, 2012 at 2:02 AM, manish narayan.shiv...@gmail.com wrote:

 Swapping two objects (not integers/chars),without using temp...?
 my solution is using xor operation..is that right and ny other solutions ?

 --
 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/-/OxVSnZ1QjzMJ.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] Printing all inversions in an array

2012-10-22 Thread Abhishek Jha
Have u tried BIT Approach

On Mon, Oct 22, 2012 at 1:40 AM, Aamir Khan syst3m.w...@gmail.com wrote:

 What is the best algorithm to print all the inversions in an array? While
 you can find the inversion count using modified merge sort procedure in
 O(nlog(n)) time [1] but I doubt that printing all inversions can also be
 done in O(nlogn).

 In an array A[], two elements A[i] and A[j] form an inversion if A[i] 
 A[j] and i  j

 [1] http://www.geeksforgeeks.org/archives/3968


 --

 Aamir Khan | 4th Year  | Computer Science  Engineering | IIT Roorkee


  --
 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] Command Line arguments

2012-10-08 Thread Abhishek Patro
will it not give an erroneous result since, argc = number of elements in
argv starting from 0?

On Sun, Oct 7, 2012 at 6:33 PM, rahul sharma rahul23111...@gmail.comwrote:

 #includestdio.h
 int main(int argc,char *argv[])
 {

   printf(%d\n,argv[argc]);
   getchar();
   return 0;

 }


 what will it print n y??
 thnx
 rahul

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




-- 
Abhishek Patro

-- 
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] using name space std

2012-10-08 Thread Abhishek Patro
if u have seen the iostream file then it begins like this:-

#include bits/c++config.h
#include ostream
#include istream
*
*
*namespace std *
{
  /**
   *  @name Standard Stream Objects
   *
   *  The lt;iostreamgt; header declares the eight emstandard stream
   *  objects/em.  For other declarations, see
   *  http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#10 and the
   *  @link s27_2_iosfwd I/O forward declarations @endlink
   *
   *  They are required by default to cooperate with the global C library's
   *  @c FILE streams, and to be available during program startup and
   *  termination.  For more information, see the HOWTO linked to above.
  */
  //@{
  extern istream cin; /// Linked to standard input
  extern ostream cout; /// Linked to standard output
  extern ostream cerr; /// Linked to standard error (unbuffered)

The new implementation is done in C# format. So we use the term using to
include the iostream package.



On Tue, Oct 9, 2012 at 12:01 AM, rahul sharma rahul23111...@gmail.comwrote:

 using name space std

 Please explain about this
 thnx

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




-- 
Abhishek Patro

-- 
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] Accolite placement papers???

2012-09-09 Thread abhishek
http://iamcodebug.wordpress.com/category/interview-question/accolite-interview-question/


On Sat, Sep 8, 2012 at 7:22 PM, mitaksh gupta mitak...@gmail.com wrote:

 Hey Varun,
 can you elaborate about the interview process a bit more.. like how many
 rounds are there.. and what to expect in each round. What to focus on
 mainly.. It would be of great help.
 Thanks
 Mitaksh Gupta


 On Sat, Sep 8, 2012 at 4:24 PM, varun singh varun2004si...@gmail.comwrote:

 For datastructure round, do practice simple datastructure questions
 generally asked in microsoft interviews.

 Varun Singh
 9958130047



 On Sat, Sep 8, 2012 at 11:13 AM, sandeep kumar 
 sandeepkumar1...@gmail.com wrote:

 Hey!!!
 Can anyone give some idea about Accolite technologies placement
 procedure and questions it asks in the interview???
 Thnx 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] Fwd: Snapdeal placement proceedure

2012-08-29 Thread Abhishek Sharma
I appeared for snapdeal's exam on 27th.The question paper had 2
sections:aptitude and programming
In aptitiude,there were questions like
1) find time after 2pm, where two hands of clock intersect
2)find max of two numbers without using if,else or comparison operators
3)3 ants on vertices of triangle
4)delete duplicates from array
5)How many 7-digit numbers are there with digits in inc. order
6)2 aptitiude ques.
7)10 bottles with pills of weight 10g each.one bottle contains pill of
9g.find the bottle

In coding section,
1)check if a str is a rotation of other
2)all elements in array are present twice except a single element which is
present only once.find that element ?
3)one aptitude ques.
4)one question related to C output

On Tue, Aug 28, 2012 at 10:25 PM, sachin singh sachin...@gmail.com wrote:



 -- Forwarded message --
 From: sachin singh sachin...@gmail.com
 Date: Tue, Aug 28, 2012 at 10:23 PM
 Subject: Snapdeal placement proceedure
 To: algogeeks@googlegroups.com



 Can anyone tell about the recruitment process of snapdeal?
 I mean how to prepare for the written test?What kind of written test it
 would be?
 What are they asking in interview? And some pointers on what skills they
 are basically looking at when they come to hire at colleges

  --
 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: CISCO Written Test ??

2012-08-29 Thread Abhishek Sharma
50 questions were there in written test ( aptitude (22), c, c++, signals,
networking, 8085, 8086)
I got 35/ 50 in written test.
In interviews, they asked questions like what is polymorphism, reverse a
linked list, explain quicksort etc.

On Mon, Aug 27, 2012 at 8:40 AM, apoorv gupta apoorvcool2...@gmail.comwrote:

 Der were many  questions from electronics part also..20 apti 20 electronic
 ques 10 c/netwrking ques..So computer science people will have a tough
 luck.So revise basics of electronics. ques like half wave rectifier
 efficiency were asked


 On Sun, Aug 26, 2012 at 10:24 PM, deepikaanand swinyanand...@gmail.comwrote:

 written test will be  (apti + tech) no negative marking

 apti from time , speed and distance, probablity , mixtures , profit
 and loss (easy)
 2 qs to infer from the passage given(critical reasoning)
 1 DI set (too simple)
 and technical qs 2 simple C o/p qs
 A large %age of qs was from digital logic design , OS , networking
 only 1 qs(which layer guarantees reliable end to end transmission)
 do practice the qs given on various sites,most of the qs are just
 repeated...
 Interview process :- resume based

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




 --
 *
 
 Thanks And Sincere Regards
 Apoorv Gupta
 Btech Final Year
 Computer Science And Engineering
 MNNIT 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] google paper

2012-08-12 Thread Abhishek Kumar
one Q is zig zag traversal in a tree nd d other one is like - A new
language is defined called googley  and it has two register only 'X' and
'Y'  and only two commands are avialable next and  print each one has
some specific function (i don't remember now) and now u are given a string
and u hav to write a series of these commands for d given string lyk for
CBC o/p is next next next print.

hope this will give u some idea..


On Sat, Aug 11, 2012 at 2:39 PM, ~*~VICKY~*~ venkat.jun...@gmail.comwrote:

 Can you share the coding questions asked. Thank you.


 On Fri, Aug 10, 2012 at 10:29 PM, Abhishek Kumar abhivai...@gmail.comwrote:

 two coding Qs + some mcqs(more than 1 option correct),time is 1.5 hr..


 On Fri, Aug 10, 2012 at 4:06 PM, deepikaanand swinyanand...@gmail.comwrote:

 Somebody from DCE plz tell the paper pattern of google...

 --
 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/-/BjLRVjRlekIJ.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.




 --
 Cheers,

   Vicky

  --
 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] Cisco paper questions

2012-08-12 Thread Abhishek Kumar
smbody plz post cisco written Qs

On Thu, Aug 9, 2012 at 12:29 PM, Abhi abhi120@gmail.com wrote:

 Hi Guys,I have Cisco  Goldman Sachs placement exams next week.
 If anyone has appeared for cisco or Goldman Sachs recentlyplz post
 some of the questions asked by them.
 It would really be of great help for me.
 Thanks

 --
 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/-/1DO6JiTEQnQJ.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] google paper

2012-08-11 Thread Abhishek Kumar
two coding Qs + some mcqs(more than 1 option correct),time is 1.5 hr..

On Fri, Aug 10, 2012 at 4:06 PM, deepikaanand swinyanand...@gmail.comwrote:

 Somebody from DCE plz tell the paper pattern of google...

 --
 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/-/BjLRVjRlekIJ.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] Local Minima in Unsorted Array

2012-08-09 Thread Abhishek Sharma
http://courses.csail.mit.edu/6.006/spring11/lectures/lec02.pdf

On Mon, Aug 6, 2012 at 12:19 AM, dheeraj chawla dheeraj.chawla...@gmail.com
 wrote:

 hello guys, check this code n tell me if i m worng

 int localminima(int a[],int start,int end)
 {int mid;

 while(startend)
 {
   mid=(start+end)/2;
 if(a[start]a[start+1])
return(1);
 else if(a[end-1]a[end])
   return(1);
   else if(a[mid]a[mid+1])
end=mid-1;
else
start=mid+1;
 }

 if(startend)
   return 0;

 return -1;
 }

 On Mon, Aug 6, 2012 at 12:15 AM, payal gupta gpt.pa...@gmail.com wrote:

 this could help although not true for many cases as said above

 http://ideone.com/w5gjK



 On Sun, Aug 5, 2012 at 8:40 AM, Ashish Goel ashg...@gmail.com wrote:

 can you give an example of what do you mean by Local minima?
 From Dave's example, it looks like the minima of the whole array..

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


 On Fri, Aug 3, 2012 at 10:32 PM, shady sinv...@gmail.com wrote:

 Hi,
 Can anyone tell how to find local minima in an unsorted array ?
 Recommended solution : O(log(n))

 Shady.

 --
 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] directi paper pattern

2012-08-02 Thread Abhishek Sharma
please mail me too. Directi is coming for written test on this 8th in our
college.
Thanks in advance..

On Tue, Jul 31, 2012 at 11:48 PM, amit singh amitsingh...@gmail.com wrote:

  hi shaukat Ali ,it will be really kind if you can forward me that paper
 of directi
 my ID:amitsingh...@gmail.com


 On Tuesday, 31 July 2012 21:42:43 UTC+5:30, md shaukat ali wrote:



 On Tue, Jul 31, 2012 at 7:37 PM, deepikaanand swinyanand...@gmail.comwrote:

 can anyone tell me the pattern (selection procedure )followed by directi
 this year

 --
 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/-/uaKshpROlGoJhttps://groups.google.com/d/msg/algogeeks/-/uaKshpROlGoJ
 .
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to algogeeks+unsubscribe@**
 googlegroups.com algogeeks%2bunsubscr...@googlegroups.com.
 For more options, visit this group at http://groups.google.com/**
 group/algogeeks?hl=en http://groups.google.com/group/algogeeks?hl=en.

 i have mailed u recently asked question by direct i in nit
 allahabad..make a view on it

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

 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] Anagram problem

2012-07-18 Thread Abhishek Sharma
sort each word in the list,then sort the whole list.
Now,sort the input word(string).
and then use binary search to find the word.

On Wed, Jul 18, 2012 at 8:59 PM, Bhupendra Dubey bhupendra@gmail.comwrote:

 Sort each of the word and form a trie , if any words comes again you get
 one sch case.


 On Wed, Jul 18, 2012 at 2:12 PM, vindhya chhabra vindhyachha...@gmail.com
  wrote:

 yes,sorry count sort will be O(n) so better.thanks

 On Wed, Jul 18, 2012 at 1:43 PM, saurabh singh saurab...@gmail.comwrote:

 ^sorting a string would be o(n^2logn) if u use q.sort.count sort would
 be better.
 Saurabh Singh
 B.Tech (Computer Science)
 MNNIT
 blog:geekinessthecoolway.blogspot.com



 On Wed, Jul 18, 2012 at 1:08 PM, vindhya chhabra 
 vindhyachha...@gmail.com wrote:

 sort the list,sort the word(use quick sort(nlogn  time))- and den
 search using binary search(logn time)
 or we can evn do by hashing-hash the word,den for every word keep
 decreasing the counter,if the hash array is zero ,anagram,else reset the
 hash array for given input for the checking the next word.


 On Wed, Jul 18, 2012 at 2:07 AM, Navin Kumar 
 algorithm.i...@gmail.comwrote:

 Assuming a preexisting list of 100 words, how would you efficiently
 see if a word received from input is an anagram of any of the 100 words?

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




 --
 Vindhya Chhabra




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




 --
 Vindhya Chhabra



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




 --
 Thanks  regards
 Bhupendra



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




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

-- 
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: [Google] Finds all the elements that appear more than n/3 times

2012-07-17 Thread Abhishek Sharma
I think it can be done by using some randomized algorithm.
Divide the array into subarrays of equal size and then pick a random
element from each group.Do it 3-4 times,if random number comes out equal
for most of the times,return that element.
I haven't tried it.

On Fri, Jul 13, 2012 at 10:53 AM, Ganesh M ganesh.muniya...@gmail.comwrote:

 I guess the 
 linkhttp://valis.cs.uiuc.edu/~sariel/research/CG/applets/linear_prog/median.htmltalks
  about modified quick sort approach. Remember, if your choise of pivot
 is bad everytime, this will have a worst case performance of O(n). You
 should refer to Selection 
 Algorithmhttp://en.wikipedia.org/wiki/Selection_algorithmfor better worst 
 case performance.

 On Wednesday, July 11, 2012 3:12:07 PM UTC+8, Navin Kumar wrote:

 @sachin:

 http://valis.cs.uiuc.edu/~**sariel/research/CG/applets/**
 linear_prog/median.htmlhttp://valis.cs.uiuc.edu/~sariel/research/CG/applets/linear_prog/median.html

 On Wed, Jul 11, 2012 at 12:28 PM, sachin goyal sachingoyal@gmail.com
  wrote:

 To Mr. B
 how will you find median in O(n) time? please elaborate.


 On Wednesday, July 11, 2012 4:01:43 AM UTC+5:30, Mr.B wrote:

 I found a similar solution looking somewhere else.

 The solution for this problem is:
 a. There can be atmost 3 elements (only 3 distinct elements with each
 repeating n/3 times) -- check for this and done. -- O(n) time.
 b. There can be atmost 2 elements if not above case.

 1. Find the median of the input. O(N)
 2. Check if median element is repeated N/3 times or more -- O(n) - *{mark
 for output if yes}*
 3. partition the array based on median found above. - O(n)  --
 {partition is single step in quicksort}
 4. find median in left partition from (3). - O(n)
 5. check if median element is repeared n/3 times or more - O(n)  *{mark
 for output if yes}*
 6. find median in right partition from (3). - O(n)
 7.  check if median element is repeared n/3 times or more - O(n)  *{mark
 for output if yes}*

 its 7*O(N) = O(N) solution. Constant space.

 we need not check further down or recursively. {why? reason it.. its
 simple}


 On Wednesday, 27 June 2012 18:35:12 UTC-4, Navin Kumar wrote:


 Design an algorithm that, given a list of n elements in an array,
 finds all the elements that appear more than n/3 times in the list. The
 algorithm should run in linear time

 ( n =0 ).

 You are expected to use comparisons and achieve linear time. No
 hashing/excessive space/ and don't use standard linear time deterministic
 selection algo.

  --
 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/-/PxIJd3So3tkJhttps://groups.google.com/d/msg/algogeeks/-/PxIJd3So3tkJ.


 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to algogeeks+unsubscribe@**
 googlegroups.com algogeeks%2bunsubscr...@googlegroups.com.
 For more options, visit this group at http://groups.google.com/**
 group/algogeeks?hl=en http://groups.google.com/group/algogeeks?hl=en.


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

 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

-- 
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: Traverse a 2-D array of strings

2012-07-15 Thread Abhishek Sharma
@atul007, but that doesn't work for extreme cases like
.sdlf.sfd.sd.f and sdf..sfdsf.sfddf

On 7/15/12, atul anand atul.87fri...@gmail.com wrote:
 1) you can count . in the input string +1 = number of tokens
 2) you can pass by reference a variable to mystrtok(string,delim,len);
 in your function at the end you can store count *len=count;
 and this len can be used in the loop.

 for(i=0;ilen;i++)

 On 7/15/12, Abhi abhi120...@gmail.com wrote:
 @atul007, number of rows represent number of tokenized strings.How do i
 know the number of tokenized strings? It depends upon input string and
 delimiter

 On Saturday, 14 July 2012 22:45:46 UTC+5:30, Abhi wrote:

 I have written a mystrtok function which takes a string and a delimiter
 as

 argument and returns an array of tokenized strings.But i don't know how
 to

 traverse that array
 Here is my code:-
 char string[50] = asdf.sdf.sdf.sdf.wer.sfd.df;
 char delim = '.';
 char **result = mystrtok( string , delim);

 for (int i=0; ??? ; i++)  //what to write in condition part
 printf(%s,result[i]);


 --
 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/-/exXJLYEOcXwJ.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

-- 
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] flipkart question

2012-07-07 Thread Abhishek Sharma
@Raj: trace karke dekh na yaar when u have 3 0s and 3 6s.. the sum
distribution would look like this:

given below are the possibilities:

Combination of 1,2,3,4,5,6 with 0
1+0 = 1
2+0 = 2
3+0 = 3

OR

4+0 = 4
5+0 = 5
6+0 = 6

Combination of 1,2,3,4,5,6 with 6

1+6 = 7
2+6 = 8
3+6 = 9

OR

4+6 = 10
5+6 = 11
6+6 = 12

ho gye na evenly distribute :)

On Sat, Jul 7, 2012 at 10:24 PM, Prakhar Jain jprakha...@gmail.com wrote:

 Label 3 of the faces with 0 and other 3 faces with 6.


 --
 Prakhar Jain
 IIIT Allahabad
 B.Tech IT 3rd Year
 Mob no: +91 9454992196
 E-mail: rit2009...@iiita.ac.in
   jprakha...@gmail.com



 On Sat, Jul 7, 2012 at 12:52 AM, Hraday Sharma hradaysha...@gmail.comwrote:

 You are given 2 dice. Both are fair. One of the dice has no numbers
 printed on it. You have to label the unmarked dice such that when both the
 dice are thrown, the sum on the faces is evenly distributed between 1 and 12
  .


  --
 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/-/uXBWN7DSu_gJ.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] Finding intersection of 2 linked lists

2012-07-05 Thread Abhishek Sharma
@nishant, you wrote until both the distance becomes equal.Which distances
? Could you please elaborate ?

On Thu, Jul 5, 2012 at 12:52 PM, Ashish Goel ashg...@gmail.com wrote:

 struct node* intersection( struct node *pL1, struct node* pL2)
 {
if ((!pL1) || (!pl2)) return NULL;
struct node * pL3 = NULL;
struct node* pL3Tail = NULL;
while(pL1)(pL2) {
 if (pL1-data pL2-data) pL1=pL1-next;
 else if  (pL1-data  pL2-data) pL2=pL2-next;
 else {
struct node *pNew = (struct node*)malloc(sizeof(struct node));
if !pNew return NULL; //scary
pNew-data = pL1-data; pNew-next = NULL;
if ( !pL3) pL3= pNew;
else pL3Tail-next = pNew;
pL3Tail = pNew;
}
return pL3;
 }




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


 On Wed, Jul 4, 2012 at 10:41 PM, Abhi abhi120...@gmail.com wrote:

 Any efficient algorithm to find intersection of two linked lists.Example:
 Linked List 1)  1 - 2 - 3 - 4 - 5 - 6
 Linked List 2)  3 - 4 - 5

 Intersection 4 - 5 - 6

 --
 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/-/-8_lnGA-ZhgJ.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

-- 
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] Permuatation of string in caase of duplicte string it shouldnt print duplicates permutation .

2012-07-04 Thread Abhishek Sharma
http://stackoverflow.com/questions/1900197/generating-variations-without-repetitions-permutations-in-java/


On Wed, Jul 4, 2012 at 8:16 PM, Nishant Pandey nishant.bits.me...@gmail.com
 wrote:

 the code works fine only in case of duplicates , but if we consider
 string to be non duplicates like say :abc then all permutation cant be
 obtainned .


 On Wed, Jul 4, 2012 at 12:31 PM, atul anand atul.87fri...@gmail.comwrote:

 you can use flag[256];

 now you just need to check
 loop:
 if (flag[str[i]]==0)
 {
  //swap()
  //permute function call
  //swap()
  flag[str[i]=1;
 }
 done


 On 7/4/12, atul anand atul.87fri...@gmail.com wrote:
  you can use flag[256];
 
  now you just need to check
  loop:
  flag[str[i]]==0)
  {
   //swap()
   //permute function call
   //swap()
   flag[str[i]=1;
  }
  done
 
  On 7/3/12, Nishant Pandey nishant.bits.me...@gmail.com wrote:
  1) Find all permutations of a string.
  2) Improve it so that the permutations are not repeated, Eg= string is
  
  Answer should be just  once not 4! times.
 
  i want suggestion to improve the recursive code in case of 2) case .
 
  --
  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.




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

-- 
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] simple FILE reading problem.

2012-07-04 Thread Abhishek Sharma
Fetch a character.
if isdigit( current_character )
  flag =1
else if current_character is any character except space

 while current_char  is not space
  current_char_position ++

On Wed, Jul 4, 2012 at 10:44 PM, Navin Kumar algorithm.i...@gmail.comwrote:

 Suppose a file.txt contains : 50 40 30 # # 5 # 10 # #

 i want to fetch only integers. How should i fetch it. I tried with fgetc
 and fscanf but it was too complicated.

 My approach: fetched one word at a time and put it into separate string
 and then i converted that string to integer(if each character of that
 string was between '0' to '9').

 Is there any simple way to do this.


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




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

-- 
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] simple FILE reading problem.

2012-07-04 Thread Abhishek Sharma
Please ignore the last post


Fetch a character.
if isdigit( current_character )
 add it to temp string
 flag =1
else if current_character is any character except space
 flag = 0
   while current_char  is not space
  current_char_position ++
else if current_char is space and flag = 1
   fetch last word (temp string)

On Wed, Jul 4, 2012 at 10:51 PM, Abhishek Sharma abhi120...@gmail.comwrote:

 Fetch a character.
 if isdigit( current_character )
   flag =1
 else if current_character is any character except space

  while current_char  is not space
   current_char_position ++


 On Wed, Jul 4, 2012 at 10:44 PM, Navin Kumar algorithm.i...@gmail.comwrote:

 Suppose a file.txt contains : 50 40 30 # # 5 # 10 # #

 i want to fetch only integers. How should i fetch it. I tried with fgetc
 and fscanf but it was too complicated.

 My approach: fetched one word at a time and put it into separate string
 and then i converted that string to integer(if each character of that
 string was between '0' to '9').

 Is there any simple way to do this.


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




 --
 Abhishek Sharma
 Under-Graduate Student,
 PEC University of Technology




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

-- 
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] Finding intersection of 2 linked lists

2012-07-04 Thread Abhishek Sharma
it was 4 - 5, not 4 - 5 - 6

On Wed, Jul 4, 2012 at 10:41 PM, Abhi abhi120...@gmail.com wrote:

 Any efficient algorithm to find intersection of two linked lists.Example:
 Linked List 1)  1 - 2 - 3 - 4 - 5 - 6
 Linked List 2)  3 - 4 - 5

 Intersection 4 - 5 - 6

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




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

-- 
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] Finding intersection of 2 linked lists

2012-07-04 Thread Abhishek Sharma
3 - 4 - 5, sorry for that silly mistakes

On Wed, Jul 4, 2012 at 10:54 PM, Abhishek Sharma abhi120...@gmail.comwrote:

 it was 4 - 5, not 4 - 5 - 6


 On Wed, Jul 4, 2012 at 10:41 PM, Abhi abhi120...@gmail.com wrote:

 Any efficient algorithm to find intersection of two linked lists.Example:
 Linked List 1)  1 - 2 - 3 - 4 - 5 - 6
 Linked List 2)  3 - 4 - 5

 Intersection 4 - 5 - 6

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




 --
 Abhishek Sharma
 Under-Graduate Student,
 PEC University of Technology




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

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

2012-07-03 Thread Abhishek Sharma
arr1 = (int *)malloc(sizeof(int) * ncols);// memory allocated for 1st
row
arr2 = (int **)malloc(sizeof(arr1) * nrows);

I haven't tried it.So,please correct me if i am wrong

On Mon, Jul 2, 2012 at 12:55 PM, Rishabh Agarwal rishabh...@gmail.comwrote:


 nrows: number of rows
 ncols: number of columns

 int **arra = (int **)malloc( sizeof(int*) * nrows );
 int *ar = (int *)malloc( sizeof(int) * nrows * ncols );
 for( int a = 0; a  nrows; a ++ ) {
 arra[a] = ar + ncols * a;
 }

 now index of array i and j can be accessed as arra[i][j]



 On Friday, June 29, 2012 4:46:18 PM UTC+5:30, rahul r. srivastava wrote:

 implement a 2d matrix using only 2 mallocs.

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

 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

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

2012-07-03 Thread Abhishek Sharma
what s silly mistake. @Rahul thanks for correcting me.

On Tue, Jul 3, 2012 at 3:41 PM, rahul ranjan rahul.ranjan...@gmail.comwrote:

 @abhishek its wrong as arr1 is just a pointer o int and sizeof(arr1)
 will always be 4 bytes(size of a pointer) regardless of number of bytes
 allocated to it on heap


 On Tue, Jul 3, 2012 at 3:14 PM, Abhishek Sharma abhi120...@gmail.comwrote:

 arr1 = (int *)malloc(sizeof(int) * ncols);// memory allocated for 1st
 row
 arr2 = (int **)malloc(sizeof(arr1) * nrows);

 I haven't tried it.So,please correct me if i am wrong


 On Mon, Jul 2, 2012 at 12:55 PM, Rishabh Agarwal rishabh...@gmail.comwrote:


 nrows: number of rows
 ncols: number of columns

 int **arra = (int **)malloc( sizeof(int*) * nrows );
 int *ar = (int *)malloc( sizeof(int) * nrows * ncols );
 for( int a = 0; a  nrows; a ++ ) {
 arra[a] = ar + ncols * a;
 }

 now index of array i and j can be accessed as arra[i][j]



 On Friday, June 29, 2012 4:46:18 PM UTC+5:30, rahul r. srivastava wrote:

 implement a 2d matrix using only 2 mallocs.

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

 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Abhishek Sharma
 Under-Graduate Student,
 PEC University of Technology

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




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

-- 
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] Question asked in Amazon Online Test

2012-06-29 Thread Abhishek Sharma
convert prefix to infix,then convert infix to postfix.Now, to convert
prefix to infix, push numbers in one stack and operators in other.Then use
thishttp://www.velocityreviews.com/forums/t445633-prefix-to-infix-conversion.html
algo
to perform this.Then do the same for infix to postfix.It works with simple
operators,but difficult to implement with parenthesis.

On Sat, Jun 30, 2012 at 12:21 AM, rahul ranjan rahul.ranjan...@gmail.comwrote:

 oh bhai mere. kewal preorder use karke kaise tree bana dega???


 On Fri, Jun 29, 2012 at 11:23 PM, amrit harry dabbcomput...@gmail.comwrote:

 @bhaskar ur algo fails on this case (5+3)-(2+(3/6))
 -+53+2/36
 63/2+35-+
 showing that 6/3 but actually it is 3/6
 so i think it could be done by folowing algo
 make a binary tree of given expression in O(n)  then do postorder
 traversal take O(n) so problem can be solved in O(n). and take O(2*n+1)
 space

 On Fri, Jun 29, 2012 at 9:13 PM, Bhaskar Kushwaha 
 bhaskar.kushwaha2...@gmail.com wrote:

 I think just reversing the prefix notation converts it to postfix
 notation


 On Fri, Jun 29, 2012 at 7:46 PM, Gobind Kumar Hembram 
 gobind@gmail.com wrote:

 Given an integer expression in a prefix format (i.e. the operator
 precedes the number it is operating on) ,  print the expression in the
 post fix format .

 Example: If the integer expression is in the prefix format is *+56-78,
 the postfix format expression is 56+78-*. Both of these
 correspond to the expression (5+6)*(7-8).

 --
 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,
 Bhaskar Kushwaha
 Student
 Final year
 CSE
 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.




 --
 Thanks  Regards
 Amritpal singh

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




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

-- 
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] can anyone tell me

2012-06-28 Thread Abhishek Sharma
naa noone can tell you.. haha.. just kidding...

for OS refer the prescribed text. I studied from Silberschatz, Galvin,
Gagne: *Operating System Concepts.. *
amazing book.. just understand the basics.. like process shceduling
algorithms, page shceduling algorithms, threads, context switching, virtual
memory, paging, thrashing, deadlocks etc...

On Thu, Jun 28, 2012 at 10:49 PM, Rahul verma
laptan2...@gmail.com wrote:

 can anyone tell me how to prepare OS subject for placement and interview

 which type of question interviewer will ask?

 which website will i prefer ?

 plzzz tell me ...

 --
 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] Programming Question

2012-06-22 Thread Abhishek Sharma
make a hashtable where,
 key is the first character of each word and,
 value is a list which contains index of each word starting with that
character.
Now, sort that hash table wrt keys.
Now print each each key and words corresponding to that key ( given by
arr[index1], arr[index2] )

On Fri, Jun 22, 2012 at 5:55 PM, Ashot Madatyan ashot...@gmail.com wrote:

 1. read the file one char at a time, and tokenize the standalone words
 (stop
 char is either space or comma or eol)
 2. put each parsed word in a structure mapchar, vectorstring , where
 the char is the key (the first letter of each scanned word). You are
 basically creating a hash table here.
 3. now print the hash table content using the formatting of your choice.

 Rgds,
 Ashot

 -Original Message-
 From: algogeeks@googlegroups.com [mailto:algogeeks@googlegroups.com] On
 Behalf Of Gobind Kumar Hembram
 Sent: Friday, June 22, 2012 2:01 PM
 To: algogeeks@googlegroups.com
 Subject: [algogeeks] Programming Question

 I was asked this question in one company Programming Round.Please help
 me in solving this,I tried with array of pointers ,2-D array and by
 buffering.

 You have a file with names of brands separated by comma. Write a
 program (in language of your choice) to group them by their starting
 letter.

 For example, if the input file is this:
 Reebok, Puma, Adidas, Clarks, Catwalk, Converse, FILA, Lotto, Newfeel,
 Nike, Numero Uno, New Balance, ASICS, Carlton London, Crocs

 The program should print the following:
 A
  ASICS, Adidas

 C
  Carlton London, Catwalk, Clarks, Converse, Crocs

 F
  FILA

 L
  Lotto

 N
  New Balance, Newfeel, Nike, Numero Uno

 P
  Puma

 R
  Reebok

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




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

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

2012-06-21 Thread Abhishek Sharma
refer to this link http://www.ics.uci.edu/~eppstein/161/960130.html.
or Using quicksort , it can be done in O(n).
One more way to do this is to make min heap of size-k. Then insert elements
from the original array.If element is greater than root of the heap,swap
them.In the Last, root of the heap would be the kth smallest element

On Wed, Jun 20, 2012 at 8:47 PM, ajeet ajeet.sing...@gmail.com wrote:

 Hi,

 It looks like, The interviewer is expecting MinHeap from you,

 If modification to array is permitted just build the heap in place (from
 end bubbleUp  n-1 time) and extract K elements in sorted order
 Otherwise you need minimum O(K) memory

 Again if you want to use the quick-sort, I would prefer only using
 partition part of quick sort..
 1. Select any pivot 'P'
 2. Partition the array..
 3. position of the pivot p
 4. if p  k ( kth min lies on left part) repeat again for k
 5 if p  k ( kth min lies on right part) repeat again for k-p
 6 if p = k ( You are lucky) exit

 Again in worst case it is o(N2)

 -Ajeet

 Thanks
 -A


 On Wednesday, 20 June 2012 00:56:36 UTC+5:30, adarsh kumar wrote:

 This can be done using the concept of median of medians, wherein we can
 achieve linear time complexity in the worst case.
 This is a concept used in parallel algorithms too, check it out.

 On Mon, Jun 18, 2012 at 5:38 PM, Prem Nagarajan 
 prem.cmna...@gmail.comwrote:

 @enchantress : This problem can be solved using quicksort in O(nlogn).
 No need to go for selection sort.
 But O(n) solution is needed.


 On Mon, Jun 18, 2012 at 2:50 PM, enchantress elaenjoy...@gmail.comwrote:


 Hi all,
 A variation of selection sort can be used which takes O(nk) time.

 for i 1 to k
   min_index = i
   for j i+1 to n
  if a[j]  a[min_index]
 min_index = j
   swap(a[i],a[min_index])

 required element : a[k]

 On Sunday, 17 June 2012 08:13:18 UTC+5:30, Prem Nagarajan wrote:

 Give an array of unsorted elements, find the kth smallest element in
 the array.

 The expected time complexity is O(n) and no extra memory space should
 be used.

 Quickselect algorithm can be used to obtain the solution. Can anyone
 explain how quickselect works?

  --
 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/-/FABBRabzVqMJhttps://groups.google.com/d/msg/algogeeks/-/FABBRabzVqMJ
 .

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


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

 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

-- 
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] Microsoft Interview Question

2012-06-21 Thread Abhishek Sharma
find the element nearest to zero.make it pivot element.then apply one pass
of quicksort over the array.this is O(n)
On Thu, Jun 21, 2012 at 12:27 AM, Akshat Sapra sapraaks...@gmail.comwrote:

 void make_group( int a[], int size) {
   int j = 0;

  for ( int i = 0; i  size; i++ ) {
  if ( a[i]  0 ) {
 swap(a[i],a[j]);
 j++;
  }
 }
 }


 --


 Akshat Sapra
 Under Graduation(B.Tech)
 IIIT-Allahabad(Amethi Campus)
 *--*
 sapraaks...@gmail.com
 akshatsapr...@gmail.com
 rit20009008@ rit20009...@gmail.comiiita.ac.in

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




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

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

2012-06-21 Thread Abhishek Sharma
@umer
it's not random,but biased


On Wed, Jun 20, 2012 at 11:16 AM, Umer Farooq the.um...@gmail.com wrote:

 Hmmm, true. That's what I expected in this solution. Similarly, we can get
 3 by (3,3) (1,2)

 However, did you take a look at the other solution I proposed? I guess
 that solves the problem to some extent.


 On Tue, Jun 19, 2012 at 7:18 PM, Sourabh Singh 
 singhsourab...@gmail.comwrote:

 @Umer and Navin :
 1 is generated by (1,3) only.
 2 is generated by (1,1) and (2,3).

 so given solution is wrong


 On Tue, Jun 19, 2012 at 5:17 AM, Sourabh Singh 
 singhsourab...@gmail.comwrote:

 @ *ALL*

 please. post along with your method .
 proof than it make's equal distribution over the given range.

 On Tue, Jun 19, 2012 at 4:47 AM, Navin Kumar 
 algorithm.i...@gmail.comwrote:

 @Umer:

 rand(5) + (rand(5)%2): = it will never give 6 because for rand(7)
 range will be 0-6.
 So better try this: rand(5) + (rand(5)%3).


 On Tue, Jun 19, 2012 at 2:45 PM, Umer Farooq the.um...@gmail.comwrote:

 rand(5) + (rand(5)%2);


 On Tue, Jun 19, 2012 at 12:30 PM, Sourabh Singh 
 singhsourab...@gmail.com wrote:

 @ sry
 condition should be:

 if(20*prob = 500/7) :-)


 On Tue, Jun 19, 2012 at 12:26 AM, Sourabh Singh 
 singhsourab...@gmail.com wrote:

 @ALL

 Given a random number generator say r(5) generates number between
 1-5 uniformly at random , use it to in r(7) which should generate a 
 random
 number between 1-7 uniformly at random

 i have seen this on many site's but not a single correct solution.
 all solution's posted got rejected by someone else.:
 plz.. suggest some algo :

 my aprroach:

 let's assume a rectangle :

 100  |___
 |___|__
 500/7   |  ||
 |  ||
 |___|__|
 0 1  2  3 4  5 67
 now :

 let : num  = rand(5);
prob = rand(5);

if(prob = rand(5))
 print  num
else
 print  5 + num*(2/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.


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


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




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




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

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

2012-06-20 Thread Abhishek Sharma
using recursion,

reverse(queue,front,rear) {
   if( front  rear ) {
 swap( queue[front], queue[rear] );
 reverse( queue, front+1, rear-1);
  }
}

On Wed, Jun 20, 2012 at 11:53 PM, Sreeprasad Govindankutty 
sreeprasad...@gmail.com wrote:

 Just a query :

 If the queue is implemented as an array, then is it not possible to swap
 the elements from the last and first position onwards until you reach
 middle point.  Wont this use O(1) space and O(n/2) time.



 On Wed, Jun 20, 2012 at 1:56 PM, Hassan Monfared hmonfa...@gmail.comwrote:

 void Reverse(std::queueint pQ)
 {
 if(pQ.empty())
 return;
  int item=pQ.front();
 pQ.pop();
 Reverse(pQ);
  pQ.push(item);
 }
 Regards

 On Wed, Jun 20, 2012 at 9:41 PM, enchantress elaenjoy...@gmail.comwrote:

 Queues are basically linked lists with head and tail pointers. It is
 possible to reverse the list by change of pointers in O(n) time n O(1)
 space.
 PS: Not considering queue ADT with enqueue dequeue operations.


 On Wednesday, 20 June 2012 18:34:46 UTC+5:30, Navin Kumar wrote:

 How to reverse a Queue .

 Constraints: Time complexity O(n). space complexity: O(1)

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

 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

-- 
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: MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-18 Thread Abhishek Sharma
In a stack, you can't access any element directly, except the top one.

On Mon, Jun 18, 2012 at 11:33 AM, Rituraj worstcod...@gmail.com wrote:

 My  iterative approach

 /*code in c*/
 #includestdio.h
 int main()
 {
  int stack[]={1,2,3,4,5,6,7,8},top=7;//
  int i,j,temp;

  for(i=1;i=top;i++)
  {
   temp=stack[i];

   for(j=i;j0;j--)
 stack[j]=stack[j-1];

   stack[0]=temp;
  }

  for(i=0;i=top;i++)
printf(%d ,stack[i] );

  return 0;
 }
  /*


 Rituraj
 2nd Yr.
 B.tech CSE
 NIT -Trichy

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




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

-- 
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] Adobe interiew question

2012-06-12 Thread Abhishek Goswami
we can handle exception handling through macro.
http://en.wikibooks.org/wiki/C_Programming/Error_handling


On Tue, Jun 12, 2012 at 9:47 PM, Anika Jain anika.jai...@gmail.com wrote:

 how can we implement exception handling in c?

 --
 Regards
 Anika Jain

  --
 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: Power(n^n)

2012-06-08 Thread Abhishek Sharma
You don't need to use BigNum or long int for this program.
Both n  k should be less than 1000.
Since there is no restriction on k,you don't need Bignum
Since both n,k are restricted,you don't need bignum.
if n5, simply reject the input and return false


On Fri, Jun 8, 2012 at 11:01 AM, Dave dave_and_da...@juno.com wrote:

 @victor: But if K = 1000, then the largest N you have to deal with is 4,
 since 4^4  1000 but 5^5  1000. So your code looks like this:

 int IsNtoNEqualK( int N, int K)
 {
 return (N==1)(K==1) || (N==2)(K==4) || (N==3){K==27) ||
 (N==4)(K==256);
 }


 On Thursday, June 7, 2012 5:14:00 PM UTC-5, Victor Manuel Grijalva
 Altamirano wrote:

 Hi, everybody!!!
 I have the follow quest...

 I have two numbers N and K,  i need to check that N^N = K.
 for example:
   if N=2 and K=4 , 2^2 = 4 so return true;
   if N=3 and K=26 ,   3^3 != 26 so return false
 But 0=N , K=1000 so N^N could be have 1000 digits.

 I program in C++, and i can use Bignum (array manipulation) + fast
 power(binary power) but i want to know if exist a mathematical property.


 --
 Victor Manuel Grijalva Altamirano
 Universidad Tecnologica de La Mixteca

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

 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

-- 
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: Power(n^n)

2012-06-08 Thread Abhishek Sharma
Ignore the last post.
Updated:
You don't need to use BigNum or long int for this program.
Both n  k should be less than 1000.
you need bignum only if there would be no restriction on k.
Since both n,k are restricted, you don't need bignum.
if n5( 5^5  1000), simply reject the input and return false


On Fri, Jun 8, 2012 at 11:49 AM, Abhishek Sharma abhi120...@gmail.comwrote:

 You don't need to use BigNum or long int for this program.
 Both n  k should be less than 1000.
 Since there is no restriction on k,you don't need Bignum
 Since both n,k are restricted,you don't need bignum.
 if n5, simply reject the input and return false


 On Fri, Jun 8, 2012 at 11:01 AM, Dave dave_and_da...@juno.com wrote:

 @victor: But if K = 1000, then the largest N you have to deal with is 4,
 since 4^4  1000 but 5^5  1000. So your code looks like this:

 int IsNtoNEqualK( int N, int K)
 {
 return (N==1)(K==1) || (N==2)(K==4) || (N==3){K==27) ||
 (N==4)(K==256);
 }


 On Thursday, June 7, 2012 5:14:00 PM UTC-5, Victor Manuel Grijalva
 Altamirano wrote:

 Hi, everybody!!!
 I have the follow quest...

 I have two numbers N and K,  i need to check that N^N = K.
 for example:
   if N=2 and K=4 , 2^2 = 4 so return true;
   if N=3 and K=26 ,   3^3 != 26 so return false
 But 0=N , K=1000 so N^N could be have 1000 digits.

 I program in C++, and i can use Bignum (array manipulation) + fast
 power(binary power) but i want to know if exist a mathematical property.


 --
 Victor Manuel Grijalva Altamirano
 Universidad Tecnologica de La Mixteca

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

 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Abhishek Sharma
 Under-Graduate Student,
 PEC University of Technology




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

-- 
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: Book Feedback needed for book from Narasimha Karumanchi

2012-06-08 Thread ABHISHEK PRAJAPATI
Its one of the best book.
If u r planning for some big jobs thn u should read this book

SDE 1
Amazon India development Center

On Fri, Jun 8, 2012 at 2:45 PM, Ramindar Singh ramin...@gmail.com wrote:

 anybody having the ebook ?



 On Friday, 8 June 2012 13:44:18 UTC+5:30, ashgoel wrote:

 Hi,
 I came across Data Structures and Algorithms Made Easy: Data Structure
 and Algorithmic Puzzles

 Request for feedback if it is worth purchase.

 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 view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/CaiO2BXclWEJ.

 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
*Abhishek Prajapati
Final Year, B.Tech(Hons)
Department of Computer Science  Engg.
NIT Jamshedpur*

-- 
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: What would be the output for the following code fragment?

2012-06-07 Thread Abhishek Sharma
Is there any online compiler which gives output for both little/big endian
machines ?
or it is fine to convert value from one form to another using a small c
program ?

On Thu, Jun 7, 2012 at 1:13 AM, Garima Mishra garima9...@gmail.com wrote:

 556 if the machine is little endian
 258 if machine is big endian

 On Jun 6, 11:57 pm, g4ur4v gauravyadav1...@gmail.com wrote:
  main()
  {
  int i=300;
  char *ptr = i;
  *++ptr=2;
  printf(%d,i);
 
 
 
 
 
 
 
  }

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




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

-- 
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: What would be the output for the following code fragment?

2012-06-07 Thread Abhishek Sharma
@prem, i don't get it.could you please elaborate the interesting part of
this solution ?


On Thu, Jun 7, 2012 at 11:39 AM, Abhishek Sharma abhi120...@gmail.comwrote:

 Is there any online compiler which gives output for both little/big endian
 machines ?
 or it is fine to convert value from one form to another using a small c
 program ?

 On Thu, Jun 7, 2012 at 1:13 AM, Garima Mishra garima9...@gmail.comwrote:

 556 if the machine is little endian
 258 if machine is big endian

 On Jun 6, 11:57 pm, g4ur4v gauravyadav1...@gmail.com wrote:
  main()
  {
  int i=300;
  char *ptr = i;
  *++ptr=2;
  printf(%d,i);
 
 
 
 
 
 
 
  }

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




 --
 Abhishek Sharma
 Under-Graduate Student,
 PEC University of Technology




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

-- 
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: What would be the output for the following code fragment?

2012-06-07 Thread Abhishek Sharma
oh ,now i see. 300 = 000100101100
first 8 bits = 0001
last 8 bits = 00101100

in case of big-endian machine, when we assign 2 to next location, last 8
bits become 0010 (2 in decimal), first 8 bits remain same.
in case of little-endian machine, when we assign 2 to next location, last 8
bits become 0010 (2 in decimal), last 8 bits remain same.

Am i right ?

On Thu, Jun 7, 2012 at 12:53 PM, Abhishek Sharma abhi120...@gmail.comwrote:

 @prem, i don't get it.could you please elaborate the interesting part of
 this solution ?


 On Thu, Jun 7, 2012 at 11:39 AM, Abhishek Sharma abhi120...@gmail.comwrote:

 Is there any online compiler which gives output for both little/big
 endian machines ?
 or it is fine to convert value from one form to another using a small c
 program ?

 On Thu, Jun 7, 2012 at 1:13 AM, Garima Mishra garima9...@gmail.comwrote:

 556 if the machine is little endian
 258 if machine is big endian

 On Jun 6, 11:57 pm, g4ur4v gauravyadav1...@gmail.com wrote:
  main()
  {
  int i=300;
  char *ptr = i;
  *++ptr=2;
  printf(%d,i);
 
 
 
 
 
 
 
  }

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




 --
 Abhishek Sharma
 Under-Graduate Student,
 PEC University of Technology




 --
 Abhishek Sharma
 Under-Graduate Student,
 PEC University of Technology




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

-- 
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] If any one have algorithms for interviews by adnan aziz ebook... Please mail ...

2012-06-07 Thread Abhishek Sharma
yes,it is helpful,but read it only if u have fully understood Introduction
to algorithms or if u have strong foundation of algorithms/data structures

On Thu, Jun 7, 2012 at 12:37 PM, BUBUN SHEKHAR dce.stu...@gmail.com wrote:

 Guys is this book useful for cracking interviews??

 On Mon, Jun 4, 2012 at 1:31 AM, Dhaval Moliya moliyadha...@gmail.comwrote:

 If any one have algorithms for interviews by adnan aziz ebook... Please
 mail ...
 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.


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




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

-- 
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] Abhishek Sharma wants to chat

2012-06-06 Thread Abhishek Sharma
---

Abhishek Sharma wants to stay in better touch using some of Google's coolest new
products.

If you already have Gmail or Google Talk, visit:
http://mail.google.com/mail/b-f2b6967bf6-d78b18cba1-gqPKMkil32YfIMUTyJpM7kfmucY
You'll need to click this link to be able to chat with Abhishek Sharma.

To get Gmail - a free email account from Google with over 7,500 megabytes of
storage - and chat with Abhishek Sharma, visit:
http://mail.google.com/mail/a-f2b6967bf6-d78b18cba1-gqPKMkil32YfIMUTyJpM7kfmucY?pc=en-rf---a

Gmail offers:
- Instant messaging right inside Gmail
- Powerful spam protection
- Built-in search for finding your messages and a helpful way of organizing
  emails into conversations
- No pop-up ads or untargeted banners - just text ads and related information
  that are relevant to the content of your messages

All this, and it's yours for free. But wait, there's more! By opening a Gmail
account, you also get access to Google Talk, Google's instant messaging
service:

http://www.google.com/talk/

Google Talk offers:
- Web-based chat that you can use anywhere, without a download
- A contact list that's synchronized with your Gmail account
- Free, high quality PC-to-PC voice calls when you download the Google Talk
  client

We're working hard to add new features and make improvements, so we might also
ask for your comments and suggestions periodically. We appreciate your help in
making our products even better!

Thanks,
The Google Team

To learn more about Gmail and Google Talk, visit:
http://mail.google.com/mail/help/about.html
http://www.google.com/talk/about.html

(If clicking the URLs in this message does not work, copy and paste them into
the address bar of your browser).

-- 
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] 2 Dim array as parameter

2012-06-06 Thread Abhishek Sharma
check the return value of malloc.
on success,it returns the pointer to that memory
on error, it returns NULL
..
if( (char*)malloc(10)==NULL)
{
printf(Not Enough memory available);
exit(1);
}


On Wed, Jun 6, 2012 at 7:20 PM, Ashish Goel ashg...@gmail.com wrote:

 Hi,

 traditional C style of passing 2D array to a C func is for example, void
 func(char **pArr, int m, int n).
 Like we validate a pointer before accessing it if it is valid, how do we
 verify that the array provided indeed has got memory allocated to it before
 accessing it


 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.




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

-- 
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] What would be the output for the following code fragment?

2012-06-06 Thread Abhishek Sharma
http://ideone.com/Zz7ET

On Thu, Jun 7, 2012 at 12:27 AM, g4ur4v gauravyadav1...@gmail.com wrote:



 main()
 {
 int i=300;
 char *ptr = i;
 *++ptr=2;
 printf(%d,i);
 }

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




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

-- 
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] importance of heaps

2012-06-05 Thread Abhishek Sharma
can anyone please tell me how important are heaps as compared to other data
structures (from interview's point of view). i am not talking about simple
min/max heaps, but advanced ones like fibonacci heaps and binomial heaps

-- 
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] implementation of dijkstra

2012-06-05 Thread Abhishek Sharma
how to implement dijkstra algorithm using fibonacci heaps ?thanks 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.



Re: [algogeeks] If any one have algorithms for interviews by adnan aziz ebook... Please mail ...

2012-06-04 Thread Abhishek Sharma
mailing you the link for same

On Mon, Jun 4, 2012 at 1:31 AM, Dhaval Moliya moliyadha...@gmail.comwrote:

 If any one have algorithms for interviews by adnan aziz ebook... Please
 mail ...
 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.




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

-- 
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] Simple Question ,Find Error

2012-06-04 Thread abhishek
This code have issue.

names[3]=names[4];
names[4]=t;

-Original Message-
From: algogeeks@googlegroups.com [mailto:algogeeks@googlegroups.com] On
Behalf Of mahendra sengar
Sent: Monday, June 04, 2012 4:13 AM
To: Algorithm Geeks
Cc: sengar.m...@gmail.com
Subject: [algogeeks] Simple Question ,Find Error

 main()
{
static char names[5][20]={pascal,ada,cobol,fortran,perl};
int i;
char *t;
t=names[3];
names[3]=names[4];
names[4]=t;
for (i=0;i=4;i++)
printf(%s,names[i]);
}

-- 
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: amazon interview questions

2012-06-04 Thread Abhishek Sharma
I think it can be done by modifying the h-array and by making some changes
in KMP-algorithm

On Mon, Jun 4, 2012 at 9:35 AM, Jeevitesh jeeviteshshekha...@gmail.comwrote:

 i have not implemented it but i can you an idea how to approach it.

 Go to Each suffix in suffix or suffix array(I would prefer suffix array as
 it is easier) traverse the each suffix till you encounter the first letter
 of the suffix you are traversing and check to see this suppose i is the
 index you found out the starting letter then check
 s.substring(0,i)==s.substring(i,2i).

 I hope you get the idea.


 On Mon, Jun 4, 2012 at 9:14 AM, utsav sharma utsav.sharm...@gmail.comwrote:

 @jeevitesh :- yes i am also thinking of suffix tree,
  but i am facing problem in implementing it. did you implement it ??


 On Mon, Jun 4, 2012 at 9:11 AM, utsav sharma utsav.sharm...@gmail.comwrote:

 @hassan :- it will not work for many strings as you are checking from
 the mid of strings. try out ababcdef,aabc.
 @atul :- it should be done in O(n).


 On Sun, Jun 3, 2012 at 11:54 PM, Hassan Monfared hmonfa...@gmail.comwrote:

 yes it's not valid


 On Sun, Jun 3, 2012 at 5:36 PM, anugrah anugrah.agra...@gmail.comwrote:

 So any string with two same characters is not valid??

 for example :

 GEEK has E followed by E.

 So GEEK is also invalid?

 On Jun 3, 1:49 pm, Hassan Monfared hmonfa...@gmail.com wrote:
  bool IsValid(string s)
  {
   for(int len=0;lens.len/2;len++)
   {
 int start1=0,start2=len+1;
 while(start2s.size())
 {
for(int i=0;ilen  start2+is.size() 
  s[start1+i]=s[start2+i];i++);
if(i==len)
 return false; //not valid
start1++;
start2++;
  }
   }
  return true; // valid
 
 
 
 
 
 
 
  }
  On Sun, Jun 3, 2012 at 12:52 PM, atul anand atul.87fri...@gmail.com
 wrote:
   can be done with O(n^2) time complexity..
 
   can it be done with O(n) complexity ???
 
   On 6/3/12, utsav sharma utsav.sharm...@gmail.com wrote:
given a string tell wether it is valid or not.
string is valid if there is no substring which have the same
 substring
following it.
 
these strings are not valid:- stringstring,geek123123rt,
abcadabcad,strngstingstrngsting
 
--
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.




 --
 *Thanks,
 Jeevitesh Shekhar Singh.*


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




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

-- 
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] MS: searching problem......help me out...

2012-06-03 Thread Abhishek Goswami
Hi,

I have  found two url which contain answer of your question some extent.

42bits.wordpress.com/2010/04/17/find-kth-minimum-in-a-unsorted-array/



http://www.medwelljournals.com/fulltext/?doi=rjasci.2011.70.75


On Sun, Jun 3, 2012 at 8:31 PM, abhinav gupta abhinav@gmail.com wrote:


   We have given a list 14 6 7 15 8 9 we have to find 15 in
 (log n ) times.
 --

 *Thanks and Regards,*

 Abhinav Kumar Gupta
 **abhinav@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] MS: searching problem......help me out...

2012-06-03 Thread Abhishek Goswami
Hi Rahul,
In the below url,They have mentioned the parallel searching. it means
divide array than search element from two point.
i.e  number of element is {48,23,10,32,5}  search 32.

divide array [0-2]  and [3-4]  range...  traverse the array from p[0] and p
[3]... till half of the loop.

I hope we can search element into log n ( need to look more just giving .2
cents)



http://www.medwelljournals.com/fulltext/?doi=rjasci.2011.70.75


On Sun, Jun 3, 2012 at 9:25 PM, Rahul Kumar Patle patlerahulku...@gmail.com
 wrote:

 @abhinav: if you want to search just 15 in log(n) time then you can use
 the concept of heap tree.. apply one round of heapification (not for all
 elements but just one time it will be complete in log(n) times), and you
 will need to swap elements but when you got element 15 you can stop..
 although space complexity has increased... you will need one redundant
 array to use heap operation so that finally you will have original array as
 it is...

 Thanks and Regards:
 Rahul Kumar Patle


 On Sun, Jun 3, 2012 at 8:31 PM, abhinav gupta abhinav@gmail.comwrote:


   We have given a list 14 6 7 15 8 9 we have to find 15 in
 (log n ) times.
 --

 *Thanks and Regards,*

 Abhinav Kumar Gupta
 **abhinav@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.


-- 
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: Google Q: longest word made of subwords within the list

2012-05-23 Thread Abhishek
@prem: can you please explain the approach clearly, I did't get the
approach.

regards
Abhishek

On May 23, 7:43 pm, Doom duman...@gmail.com wrote:
 I am trying to understand the question.. please let me know the answer for
 the following cases..

 case1:
 test
 testlong
 testlongtest
 testlongtestlong
 testtesttest

 case2:
 test
 testlong
 testlongtest

 case3:
 test
 longest

 case4:
 test
 testtes
 ttes
 testtesttes







 On Tuesday, 22 May 2012 18:15:16 UTC+5:30, ashgoel wrote:

  write a program to find the longest word made of other words. For
  instance, If my file has the following words (sorted):
  test
  tester
  testertest
  testing
  testingtester

  The longest word should be testingtester. Trie is the solution, what is
  the best Order possible?
  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.



[algogeeks] Re: Microsoft interview question

2012-05-21 Thread Abhishek
@Gaurav: you are taking ia and ib as int so they will have 32 bits in
Java. So you can not set the bits for numbers in the array greater
than 32.
e.g if you have a[i]=59876 so you would want to set the 59876th bit in
ia : ia=ia | (159876) but that is not possible. How do you handle
this?
Also how do you handle the case for negative numbers??
What I think we can do is:
If we take ia and ib as BigInteger in Java then we don't have that
constraint of 32 bits. I tried it out it works for large no as 35000
instantly.
But that still doesn't solve the problem of -ve numbers.

regards
Abhishek Khanna

On May 20, 1:42 am, GAURAV CHAWLA togauravcha...@gmail.com wrote:
 we can do it bitwise...

 i can set the corresponding bit by 1 of any int ...
 lets take
 int ia,ib=0;
 and set the a[i]th bit of ia as 1 ,
 and similar for  bth array and ib ...

 and finally check.. if(ia==ib){permutation of each other}

 hope this will work..

 On Sun, May 20, 2012 at 1:39 AM, malay chakrabarti m1234...@gmail.comwrote:



  dat defeats the o(1) space constraint. :-)
  On May 19, 2012 8:05 PM, HARSHIT PAHUJA hpahuja.mn...@gmail.com wrote:

  @malay ---  we can do it by precomputing the prime arrays
  

  On Sun, May 20, 2012 at 1:10 AM, malay chakrabarti 
  m1234...@gmail.comwrote:

  method is ryt but to find ith prime u cannot to it in constant time.
   On May 19, 2012 7:30 PM, HARSHIT PAHUJA hpahuja.mn...@gmail.com
  wrote:

  given 2 unsorted integer arrays a and b of equal size. Determine if b
  is a permutation of a. Can this be done in O(n) time and O(1) space ?

  please help me with my solution

  suppose a --  3 5 4
               b --  4 3 5

  now we replace a[i] with a[i]..th prime number  and b with b[i] .. th
  prime number

    now array  a becomes  5 11 7
           array  b becomes  7 5 11

  now we take product of elements of array a and do the same with array
  b elements
  if product is equal  then b is a permutation of a

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

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

 --
 Regards,
 GAURAV CHAWLA
 +919992635751
 +919654127192

-- 
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] Permutations of a string

2012-05-07 Thread abhishek
http://www.geeksforgeeks.org/archives/767 just look into url

-Original Message-
From: algogeeks@googlegroups.com [mailto:algogeeks@googlegroups.com] On
Behalf Of Sairam Ravu
Sent: Monday, May 07, 2012 12:59 PM
To: algogeeks@googlegroups.com
Subject: Re: [algogeeks] Permutations of a string

Somebody please help me!!


-- 
With love and regards,
Sairam Ravu
I M.Tech(CS)
Sri Sathya Sai Institute of Higher Learning
To live life, you must think it, measure it, experiment with it,
dance it, paint it, draw it, and calculate 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.

-- 
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 a point closest to other points

2012-05-06 Thread abhishek kumar
Not Necessary but for some case only

On Tue, May 1, 2012 at 8:44 PM, Bhupendra Dubey bhupendra@gmail.comwrote:

 Find the centroid

 X= (x1 +x2xn)/N
 Y=(y1+y2..yn)/N
 This will precisely be the point no need to calculate and check with
 distance.


 On Tue, May 1, 2012 at 1:18 PM, mohit mishra mohit7mis...@gmail.comwrote:

 Let me know if there is any bug
 /*using centroid of plane */

 struct point
 {
 int x;
 int y;
 };
 typedef struct point Point;
 int main()
 {
 int n,i;
 int d,dis;
 float sum_x=0,sum_y=0;
 Point centroid,final;
 //clrcsr();
 printf(how many points?  );
 scanf(%d,n);
 Point p[100];
 printf(enter X and Y cordinates of %d points\n,n);
 for(i=0;in;i++)
 scanf(%d%d,p[i].x,p[i].y);
 for(i=0;in;i++)
 {
 sum_x=sum_x+p[i].x;
 sum_y=sum_y+p[i].y;
 }
centroid.x=(int)sum_x/n;
centroid.y=(int)sum_y/n;
 for(i=0;in;i++)
 {
 dis=distance(centroid,p[i]);
 if(disd)
 {
  d=dis;
  final.x=p[i].x;
  final.y=p[i].y;

  }
 }
 printf(\n The point is (%3d  ,%3d),final.x,final.y);
 getch();
 return 0;
 }
 int distance(Point A,Point B)
 {
 int x,y;
 x=(A.x-B.x)*(A.x-B.x);
 y=(A.y-B.y)*(A.y-B.y);
 return sqrt(x+y);
 }


 On Mon, Apr 30, 2012 at 4:34 PM, kosgi santosh santoshko...@gmail.comwrote:

 how can we find centriod of n points in a plane?





 Regards,
 Santosh K.

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




 --
 bhupendra dubey

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




-- 
Abhishek Kumar
B.Tech(IT) Graduate
Allahabad
Contact no-+919663082731

-- 
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: String comparison

2012-05-02 Thread abhishek
Thx for providing some insight.

-Original Message-
From: algogeeks@googlegroups.com [mailto:algogeeks@googlegroups.com] On
Behalf Of Gene
Sent: Wednesday, April 18, 2012 5:40 PM
To: Algorithm Geeks
Subject: [algogeeks] Re: String comparison

You can't solve a problem like this with only examples of .  A
complete definition is necessary.  For example, what do you do with
a1 ? 2b
Report mismatch?
What do you do with
1 abc ? 2 2
Do you report  or mismatch?
Here is one of infinitely many complete definitions consistent with
your examples:
1. Split each string into lists of maximal tokens consisting of all
decimal digits or all letters.  White space separates tokens but is
otherwise ignored.  Anything other than digits, letters, and
whitespace is counted as end of string.
2. Call these lists A and B.  Compare them pairwise.  If Ai and Bi
are
both strings of letters, compare them lexically using UTF-8 order.
If
Ai and Bi are all digits, compare them numerically.  Continue until
you find an inequality between a pair and report this immediately,
ignoring the rest of the string.  If you find a pair with types
(letters or digits) that don't match, or if one token list is shorter
than the other, report nothing. Otherwise if you run out of pairs,
report equal.
Here is code that is probably pretty close to this definition.  Tasks
like this are easier if you split them up into a token scanning step
and a processing step. I've done that here.

#include stdio.h
#include ctype.h

// Scanner return values.
#define END 0
#define DIGITS 1
#define ALPHA 2

// Find the start and end of the first token
// beginning at *start, ignoring initial white space.
int scan(char **start, char **end)
{
  char *p = *start;
  while (isspace(*p)) ++p;
  if (isdigit(*p)) {
*start = p;
do ++p; while (isdigit(*p));
*end = p;
return DIGITS;
  }
  if (isalpha(*p)) {
*start = p;
do ++p; while (isalpha(*p));
*end = p;
return ALPHA;
  }
  return END;
}

// Return the non-negative value of the string
// starting at p and ending at the char before end.
int int_value(char *p, char *end)
{
  int x = 0;
  while (p != end)
x = 10 * x + (*p++ - '0');
  return x;
}

// Possible comparison values.
#define LT -1
#define EQ 0
#define GT 1
#define NOTHING 2

// Compare the strings starting at xp and ending
// one char before x_end where x is a or b.
int string_compare(char *ap, char *a_end,
   char *bp, char *b_end)
{
  while (ap  a_end  bp  b_end) {
int diff = *ap++ - *bp++;
if (diff  0) return LT;
if (diff  0) return GT;
  }
  if (bp  b_end) return LT;
  if (ap  a_end) return GT;
  return EQ;
}

// Compare tokens in strings a and b.
int compare(char *a, char *b)
{
  char *a_end, *b_end;

  while (1)  {
int a_scan = scan(a, a_end);
int b_scan = scan(b, b_end);
if (a_scan != b_scan) return NOTHING;
if (a_scan == END) return EQ;
if (a_scan == DIGITS) {
  int a_val = int_value(a, a_end);
  int b_val = int_value(b, b_end);
  if (a_val  b_val) return LT;
  if (a_val  b_val) return GT;
}
else if (a_scan == ALPHA) {
  int cmp = string_compare(a, a_end, b, b_end);
  if (cmp != EQ) return cmp;
}
a = a_end;
b = b_end;
  }
}

int main(void)
{
  char *s[] = {
a5, a11,
6xxx, 007asdf,
00042Q, 42s,
6   8, 006 9,
  };
  int i;
  for (i = 0; i  sizeof s / sizeof s[0]; i += 2) {
int cmp = compare(s[i], s[i + 1]);
printf(%s %c %s\n, s[i], =?[cmp + 1], s[i + 1]);
  }
  return 0;
}


On Apr 17, 11:46 pm, abhishek zeal.gosw...@gmail.com wrote:
 Hi,

 I need to compare string into following way. Can anyone provide me some
 insight or algorithm in c++.

   For example:

      a5  a11        - because 5 is less than 11
      6xxx  007asdf    - because 6  7
      00042Q  42s      - because Q  s alphabetically
      6   8  006 9   - because 8  9

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



Re: [algogeeks] Re: find where the two list connect

2012-05-01 Thread Abhishek Sharma
@Bhupendra: your approach is correct but in case the linked lists contain
millions of nodes then this might be an overhead.

Another approach could be:

- Start with the head of of both the lists.
- Store (Hash) the addresses to which the current nodes are pointing to, in
a hashtable.
- while storing (Hashing) also check if the address already exists (for
both of them). In case it exists in the hashtable, this address (or node)
is the required node else, increment the pointers to the next nodes.

This algo will not require traversing the whole lists and will save time.

Regards,
AB

On Tue, May 1, 2012 at 9:36 PM, Umer Farooq the.um...@gmail.com wrote:

 You don't have to traverse the nodes of two lists simultaneously.

 You have to check if the every node of list one matches with the address
 of any node of list two. The first matching address will be the output.

 The worst case running time of this algo will be O(n^2)


 On Tue, May 1, 2012 at 8:47 PM, rafi rafiwie...@gmail.com wrote:

 i dont understan if i look in the pic i attached then the length of
 the first list is 5 and the length of the second list is 6.
 what should i do now?
 if i traverse the long list 5,6 nodes i dont get to the red node.
 what am i missing?

 On 1 מאי, 18:04, Bhupendra Dubey bhupendra@gmail.com wrote:
  start from head of both and  as soon as one of the list is empty means
  you
  hit null
  start counting the remaining number of nodes in the other list till that
  gets empty.
 
  Now the number obtained  above is the difference in length of the two
 list
  prior to the first common node (the red node). Now again traverse the
  longer list corresponding to the above count and then start  traversing
 the
  other list .Stop when two nodes become equal. Home!:)
 
  On Tue, May 1, 2012 at 7:55 PM, רפי וינר rafiwie...@gmail.com wrote:
   you have two linked lists that some where combine in to one list.
   pic attached to illustrate
[image: Inline image 1]
   you need to find where the two list collide. (in the pic the red node)
 
   --
   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.
 
  --
  bhupendra dubey
 
   Untitled.png
  14Kהצגהורדה

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


-- 
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: String comparison

2012-04-18 Thread Abhishek Goswami
Thx for in detail description and some insight

On Wed, Apr 18, 2012 at 5:40 PM, Gene gene.ress...@gmail.com wrote:

 You can't solve a problem like this with only examples of .  A
 complete definition is necessary.  For example, what do you do with
 a1 ? 2b
 Report mismatch?
 What do you do with
 1 abc ? 2 2
 Do you report  or mismatch?
 Here is one of infinitely many complete definitions consistent with
 your examples:
 1. Split each string into lists of maximal tokens consisting of all
 decimal digits or all letters.  White space separates tokens but is
 otherwise ignored.  Anything other than digits, letters, and
 whitespace is counted as end of string.
 2. Call these lists A and B.  Compare them pairwise.  If Ai and Bi
 are
 both strings of letters, compare them lexically using UTF-8 order.
 If
 Ai and Bi are all digits, compare them numerically.  Continue until
 you find an inequality between a pair and report this immediately,
 ignoring the rest of the string.  If you find a pair with types
 (letters or digits) that don't match, or if one token list is shorter
 than the other, report nothing. Otherwise if you run out of pairs,
 report equal.
 Here is code that is probably pretty close to this definition.  Tasks
 like this are easier if you split them up into a token scanning step
 and a processing step. I've done that here.

 #include stdio.h
 #include ctype.h

 // Scanner return values.
 #define END 0
 #define DIGITS 1
 #define ALPHA 2

 // Find the start and end of the first token
 // beginning at *start, ignoring initial white space.
 int scan(char **start, char **end)
 {
  char *p = *start;
  while (isspace(*p)) ++p;
  if (isdigit(*p)) {
*start = p;
do ++p; while (isdigit(*p));
*end = p;
return DIGITS;
  }
  if (isalpha(*p)) {
*start = p;
do ++p; while (isalpha(*p));
 *end = p;
return ALPHA;
  }
  return END;
 }

 // Return the non-negative value of the string
 // starting at p and ending at the char before end.
 int int_value(char *p, char *end)
 {
  int x = 0;
   while (p != end)
x = 10 * x + (*p++ - '0');
  return x;
 }

 // Possible comparison values.
 #define LT -1
 #define EQ 0
 #define GT 1
 #define NOTHING 2

 // Compare the strings starting at xp and ending
 // one char before x_end where x is a or b.
 int string_compare(char *ap, char *a_end,
   char *bp, char *b_end)
 {
  while (ap  a_end  bp  b_end) {
 int diff = *ap++ - *bp++;
if (diff  0) return LT;
if (diff  0) return GT;
   }
  if (bp  b_end) return LT;
  if (ap  a_end) return GT;
  return EQ;
 }

 // Compare tokens in strings a and b.
 int compare(char *a, char *b)
 {
   char *a_end, *b_end;

  while (1)  {
int a_scan = scan(a, a_end);
int b_scan = scan(b, b_end);
 if (a_scan != b_scan) return NOTHING;
if (a_scan == END) return EQ;
if (a_scan == DIGITS) {
   int a_val = int_value(a, a_end);
  int b_val = int_value(b, b_end);
   if (a_val  b_val) return LT;
  if (a_val  b_val) return GT;
}
else if (a_scan == ALPHA) {
   int cmp = string_compare(a, a_end, b, b_end);
  if (cmp != EQ) return cmp;
}
a = a_end;
 b = b_end;
  }
 }

 int main(void)
 {
  char *s[] = {
a5, a11,
6xxx, 007asdf,
00042Q, 42s,
6   8, 006 9,
  };
  int i;
  for (i = 0; i  sizeof s / sizeof s[0]; i += 2) {
int cmp = compare(s[i], s[i + 1]);
printf(%s %c %s\n, s[i], =?[cmp + 1], s[i + 1]);
  }
  return 0;
 }


 On Apr 17, 11:46 pm, abhishek zeal.gosw...@gmail.com wrote:
  Hi,
 
  I need to compare string into following way. Can anyone provide me some
  insight or algorithm in c++.
 
For example:
 
   a5  a11- because 5 is less than 11
   6xxx  007asdf- because 6  7
   00042Q  42s  - because Q  s alphabetically
   6   8  006 9   - because 8  9
 
  Thx 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.



[algogeeks] string comparsion

2012-04-17 Thread Abhishek Goswami
Hi,

I need to compare string into following way. Can anyone provide me some
insight or algorithm in c++.

  For example:

 a5  a11- because 5 is less than 11
 6xxx  007asdf- because 6  7
 00042Q  42s  - because Q  s alphabetically
 6   8  006 9   - because 8  9



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



[algogeeks] String comparison

2012-04-17 Thread abhishek
Hi,

I need to compare string into following way. Can anyone provide me some
insight or algorithm in c++.

  For example:
 
 a5  a11- because 5 is less than 11
 6xxx  007asdf- because 6  7
 00042Q  42s  - because Q  s alphabetically
 6   8  006 9   - because 8  9

 

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



Re: [algogeeks] Re: MS QUESTION_LINKED LIST

2012-03-24 Thread Abhishek Sharma
@Atul: after u sort the list the head pointer will automatically point to
the smallest element so u actually return the head of the list.

@Sambhavna:

here is the Pseudoccode (More or less similar to, doing merge sort for
arrays):

Mersgesort(node ** list){
if( head==NULL or head- next == NULL) return;

//split the list into 2 halves (lets say *a and *b)
  split(list, a , b);

//sort the two halves individually
   mergesort(a);
   mergesort(b);

   //merge the two halves and return the smallest (first) element
   *head = sortedMerge(a,b);
}

for merging u can use recursion:
Merge(node *a, node *b){

  struct node *temp;
   if (a== NULL ) return b;
   if(b==NULL) return a;

  if(a- data = b- data)
   temp = a;
   temp- next = Merge(a-next, b);
 else
   temp = b;
   temp- next = Merge(a, b- next);
  return;
}





On Sat, Mar 24, 2012 at 1:55 PM, Sambhavna Singh coolsambha...@gmail.comwrote:

 can anyone explain vividly how we can use merge sort here. thank you.


 On Sat, Mar 24, 2012 at 1:54 PM, Sambhavna Singh 
 coolsambha...@gmail.comwrote:

 @atul: we always need to point at the next larger node..so that is ruled
 out.

 On Sat, Mar 24, 2012 at 10:14 AM, Atul Singh atulsingh7...@gmail.comwrote:

 I couldn't understand the meaning of  *return the pointer to smallest*
 
 Is it that that the pointer of largest node will point to smallest node.



 ATul Singh | Final Year  | Computer Science  Engineering | NIT
 Jalandhar  | 9530739855 |

 --
 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] MS QUESTION_LINKED LIST

2012-03-23 Thread Abhishek Sharma
It is basically sorting the linked list. Do not change the first pointer of
nodes and use the second pointer for sorting. return the pointer to the
smallest element. That's it.

On Sat, Mar 24, 2012 at 12:50 AM, Atul Singh atulsingh7...@gmail.comwrote:

 Given a linked list with each node having two pointers : one pointing to
 next node  other to null;
 how will u point the second pointer to next larger no. and return the
 pointer to smallest node



 --
 ATul Singh | Final Year  | Computer Science  Engineering | NIT Jalandhar
  | 9530739855 |

 --
 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: MS QUESTION_LINKED LIST

2012-03-23 Thread Abhishek Sharma
@don: inplace Mergesort can be used. Complexity would be O(nlogn).
@Ashish: Heapsort is reliable but unstable and also, slower.

On Sat, Mar 24, 2012 at 1:49 AM, Don dondod...@gmail.com wrote:

 A merge sort will be O(n*log n) and not use the extra memory required
 for a heap.
 Don

 On Mar 23, 3:11 pm, Ashish Goel ashg...@gmail.com wrote:
  actually, multimap can be avoided, each element of heap is key,value
 where
  key is the element and value is address and build heap on key.
  Best Regards
  Ashish Goel
  Think positive and find fuel in failure
  +919985813081
  +919966006652
 
 
 
  On Sat, Mar 24, 2012 at 1:40 AM, Ashish Goel ashg...@gmail.com wrote:
   don't know if i am complicating..assumption,
 
   build a multimap of values and the corresponding node address as well
 as a
   heap from the given nodes in first pass.
 
   now from minheap pick one by one and set the second pointer of previous
   picked min element to this element using multimap(remove from multimap
 in
   parallel while updating the second pointers).
 
   Best Regards
   Ashish Goel
   Think positive and find fuel in failure
   +919985813081
   +919966006652
 
   On Sat, Mar 24, 2012 at 12:50 AM, Atul Singh atulsingh7...@gmail.com
 wrote:
 
   Given a linked list with each node having two pointers : one pointing
 to
   next node  other to null;
   how will u point the second pointer to next larger no. and return the
   pointer to smallest node
 
   --
   ATul Singh | Final Year  | Computer Science  Engineering | NIT
   Jalandhar  | 9530739855 |
 
   --
   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.- Hide quoted text -
 
  - Show quoted text -

 --
 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] java help

2012-02-03 Thread abhishek
http://viralpatel.net/blogs/2009/01/how-to-take-screen-shots-in-java-taking-screenshots-java.html


On Fri, Feb 3, 2012 at 8:35 AM, Arun Vishwanathan aaron.nar...@gmail.comwrote:

 Hi,
 does anybody know how to take a screenshot of screen with java ?

 I also need help regarding storing the screenshot image into a doc file or
 so. Any suggestions?

  --
 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] Sorting for large data

2012-01-14 Thread Abhishek Goswami
Hi,
Could any point out me any algorithm and program  if we need to sort to
large data
like 10 ^ 80 with memory constraint. Suppose you have minimum memory like 4
MB.

I am not sure that this algo discussed or not but i was not able to find in
this group.

Thanks
Abhishek

-- 
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: Sorting for large data

2012-01-14 Thread Abhishek Goswami
@DAVE
hmm I am agree with you that we  will not have that much huge
data. This question came in my interview process and I was not able to
figure out the solution of this issue.So I thought to check this forum

On Sun, Jan 15, 2012 at 12:40 AM, Dave dave_and_da...@juno.com wrote:

 @Abhishek: Do you really mean 10 to the 80th power. I doubt if there
 is that much information in the world.

 Dave

 On Jan 14, 12:09 pm, Abhishek Goswami zeal.gosw...@gmail.com wrote:
  Hi,
  Could any point out me any algorithm and program  if we need to sort to
  large data
  like 10 ^ 80 with memory constraint. Suppose you have minimum memory
 like 4
  MB.
 
  I am not sure that this algo discussed or not but i was not able to find
 in
  this group.
 
  Thanks
  Abhishek

 --
 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 path in two nodes of a binary search tree

2012-01-02 Thread Abhishek Gupta
we might implement it using recursive calls where once found..the node is
printed and true is returned and if leaf is reached...false is
returnedall the function calls getting true will again print and return
true...and false will just return false without printing...this way we can
print only nodes which are in path from root to target node...i can assume
it to be a simple binary seach tree...




On Mon, Jan 2, 2012 at 10:12 PM, top coder topcode...@gmail.com wrote:

 Suppose you have a tree. A binary tree (for something like
 simplicity :p). You are traversing it (using infix, postfix or prefix)
 to search for a node. You find your required node. You just realized
 that you need to know the path from this node back to the root node
 (and/or vice versa). Given the following description of the structure
 of the tree node that you “cant” change:

 struct node{Data data; node *right,*left;};

 what will you strategy be to tackle this problem.

 To make it more intresting (or maybe just the application of the above
 problem) suppose you find the node A and a node B in consecutive
 searches. Now what will your strategy be to show a path from A to B.
 (not neccesarily from the root of the whole tree, but possibly).

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




-- 
Thanks  Regards
Abhishek Gupta
BITS, Pilani

-- 
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] Any book suggestion for Data structure and algo.

2011-12-17 Thread Abhishek Goswami


-- 
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] Any book suggestion for Data structure and algo.

2011-12-17 Thread Abhishek Goswami
Cool Rahul

On Sat, Dec 17, 2011 at 3:09 PM, Rahul raikra...@gmail.com wrote:

 Google this
 6.046

 You should not ask any more suggestion  till you complete the above

 On Sat, Dec 17, 2011 at 3:07 PM, Abhishek Goswami 
 zeal.gosw...@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] Any book suggestion for Data structure and algo.

2011-12-17 Thread Abhishek Goswami
ya Sure Thx bro

On Sat, Dec 17, 2011 at 3:15 PM, Rahul raikra...@gmail.com wrote:

 If you have time then Do a Google this
 www.algo-class.org


 On Sat, Dec 17, 2011 at 3:13 PM, Abhishek Goswami 
 zeal.gosw...@gmail.comwrote:

 Cool Rahul


 On Sat, Dec 17, 2011 at 3:09 PM, Rahul raikra...@gmail.com wrote:

 Google this
 6.046

 You should not ask any more suggestion  till you complete the above

 On Sat, Dec 17, 2011 at 3:07 PM, Abhishek Goswami 
 zeal.gosw...@gmail.com wrote:


  --
 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] Any one

2011-11-23 Thread abhishek kumar
You are given a word and a dictionary. Now propose an algorithm edit
the word (insert / delete characters) minimally to get a word that
also exists in the dictionary. Cost of insertion and deletion is same.
Write pseudocode for it.

Seems like minimum edit distance problem but some modification is
needed.


-- 
Abhishek Kumar
B.Tech(IT) Graduate
Allahabad
Contact no-+919663082731

-- 
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] LCA of a Binary tree not a binary search tree

2011-11-22 Thread abhishek kumar
If you maintain the parent, it'll be a simple problem.
Just go to the two nodes and then trace their parents till you reach the
common node.

On Tue, Nov 22, 2011 at 1:59 PM, anshu mishra anshumishra6...@gmail.comwrote:

 first try to understand the sol then comment. it is for binary tree not
 for BST.

 On Mon, Nov 21, 2011 at 10:25 PM, Piyush Grover piyush4u.iit...@gmail.com
  wrote:

 For BST it would be rather simpler. find the first node which lies in
 between the two.

 On Wed, Nov 16, 2011 at 1:44 PM, anshu mishra 
 anshumishra6...@gmail.comwrote:

 Node *LCA(node *root, node *e1, node *e2, int x)

 {

 Node *temp =NULL;

 Int y = 0;

 If (root-left) temp = LCA(root-left, e1, e2, y);

 x+=y;

 if (temp) return temp;

if (x==2) return node;

 y = 0;

 If (root-right) temp = LCA(root-right, e1, e2, y);

 x+=y;

 if (temp) return temp;

 if (x==2) return node;

 If (root == e1 || root == e2) x++;

 Return null;

 }

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




 --
 Anshuman Mishra | Software Development Engineer | Amazon


  --
 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
*Abhishek*

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

2011-10-31 Thread abhishek kumar
Represent the dependencies as a graph. Store all the values in a list. For
each vertex in the graph find all values for which there is no edge from
the vertex. If these values are there in the list, remove them from the
list and create a set of the vertex and the removed values.
If the values are not there in the list then create a set with the vertex
only. Do this for all the vertices.

On Mon, Oct 31, 2011 at 5:51 PM, Bharath 2009503507 CSE 
bharathgo...@gmail.com wrote:

 Given a set of values..in which there are some dependencies..

 Eg..  x y z a b

 Dependencies: x,y
 a,z

 Note that dependency is not transitive..Is it possible to separate
 these elements into sets such that no two elements in the same set are
 dependant and we should end up with the least number of sets..

 I could not find a good solution for this..Please help me..

 Regards,

 Bharathwajan

 --
 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: remove duplicate words from a string

2011-10-13 Thread Abhishek Khanna
@Ankur
In a trie u first insert the first word ..take the second word..If its
not
present in the trie u insert it else remove it from original string:
removing the word requires left shifting the entire string

Alternatively u store the elements in a trie in the initial string and
terminate it with '\0' and return it:
how do we reconstruct the string after creating the trie as we do not
know the sequence of words
and also some words will contain other words as prefixes.

On Oct 11, 2:14 am, Ankur Garg ankurga...@gmail.com wrote:
 @Sunny..How do u intend to store them in a Tree ? Can you explain ?

 In a trie u first insert the first word ..take the second word..If its not
 present in the trie u insert it else remove it from original string
 .Alternatively u store the elements in a trie in the initial string and
 terminate it with '\0' and return it . In the worst case trie will take O(n)
 space where n is the no of letters in the string . and Traversal  and
 creation and search too will take O(n).

 How abt Balanced Binary Tree ?

 On Tue, Oct 11, 2011 at 12:38 AM, sunny agrawal 
 sunny816.i...@gmail.comwrote:







  Trie will take too much space..
  Balanced Binary tree can be Better ...??

  On Tue, Oct 11, 2011 at 12:16 AM, Ankur Garg ankurga...@gmail.com wrote:

  I think this can be done through tries

  Any better solution ?

  On Mon, Oct 10, 2011 at 10:59 PM, sachin goyal 
  monugoya...@gmail.comwrote:

  remove duplicate words from a string with min. complexityy.

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

  --
  Sunny Aggrawal
  B.Tech. V year,CSI
  Indian Institute Of Technology,Roorkee

   --
  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] subset of an array

2011-10-10 Thread abhishek sharma
yea DP will be O(given no * n) if all array entries are positive and the
given no is non negative.

On Mon, Oct 10, 2011 at 11:09 PM, anshu mishra anshumishra6...@gmail.comwrote:

 the simplest code could be for this question is

 void printAllSubsetSum(int ar[], int n, int x)
 {
 for (i = 0; i  (1n); i++)
 {
 int sum = 0;
  for (j = 0; j  n; j++)
  {
 if ( (1  j)  i) sum += ar[j];
  }
  if (sum == x)
  {
 for (j = 0; j  n; j++)
{
if ( (1  j)  i) printf(%d , ar[j]);
}
   printf(\n);
  }
 }
 }

 Time complexity O(2^n)

 this can be solved using DP in O(n * given number);

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




-- 
Nice Day

Abhishek Sharma
Bachelor of Technology
IIT Kanpur (2009)

-- 
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] Given a String with unnecessary spaces, compact it in place

2011-10-10 Thread abhishek sharma
Can in place compaction be done without left shifts?



-- 
Nice Day

Abhishek Sharma
Bachelor of Technology
IIT Kanpur (2009)

-- 
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: another group?

2011-10-07 Thread Abhishek
Do you think we require two group. it will be good if we post all
query in one group. it is up to people who want to read or reply the
mail

On Oct 7, 12:25 am, arvind kumar arvindk...@gmail.com wrote:
 great idea..totally agreed! :)

 On 10/7/11, shady sinv...@gmail.com wrote:



  no, just two group
  algogeeks - algorithms
  interview-street - job related questions, interview questions, guidance,
  books request
  if questions are algorithmic in nature then you can ask it in either of the
  group... just be specific while asking questions and do search the archives
  before asking.

  the other one is restricted to a limit which is full.

  On Fri, Oct 7, 2011 at 10:52 AM, Amol Sharma amolsharm...@gmail.com wrote:

  too many groups :(
  --

  Amol Sharma
  Third Year Student
  Computer Science and Engineering
  MNNIT Allahabad
   http://gplus.to/amolsharma99
  http://twitter.com/amolsharma99http://in.linkedin.com/pub/amol-sharma/21/79b/507http://youtube.com/amolsharma99

  On Fri, Oct 7, 2011 at 10:48 AM, shady sinv...@gmail.com wrote:

 http://groups.google.com/group/http://groups.google.com/group/interview-street?hl=en
  *interview-street http://groups.google.com/group/interview-street?hl=en
  *
  *
  *
  * http://groups.google.com/group/interview-street?hl=en**fine, here it
  is. If anyone posts any kind of stuff like Which company, what ctc, where
  to
  apply ? which coll. ? i need books ? how to prepare for aptitude in
  algogeeks **he/she will be banned right away. No warnings. For such
  purposes use the interview-street group.*
  *
  *
  *Thanks.*

  On Fri, Oct 7, 2011 at 10:36 AM, Hatta tmd...@gmail.com wrote:

  algogeeks-jobs? :-)

  perhaps the current owners/moderators could do that?

  On Thu, Oct 6, 2011 at 8:38 PM, Arun Vishwanathan
  aaron.nar...@gmail.com wrote:
   Hey all,

   Just a thought...since people feel strongly the urge to post only algo
   related questions here, can a new group be made to post stuff related
  to
   interviews and the questions asked for different companies?I thot it
  wud be
   really helpfulin case one needs to discuss the answers for some
   questions he can either post them to the same group itself or
   otherwsie
  to
   the algos group if a general algo is needed or so from the
   paper...what
  say?
   Arun

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

  --
  Hatta

  --
  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.- Hide quoted text -

 - Show quoted text -

-- 
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: All valid dictionary words must be found and printed.

2011-10-05 Thread abhishek sharma
if we use brute force we have sum(n + n-1 + .. n-r .. + 1) = n*n words which
are to be checked. Therefore O(n-sq).

now, if i can use a dictionary interface to reject some prefix altogether,
than i need not check some words, o/w with the given interface we cannot do
it any better than quadratic time.

On Tue, Oct 4, 2011 at 6:23 PM, Navneet navneetn...@gmail.com wrote:

 What is the source of this question?

 On Sep 20, 4:49 am, Ankur Garg ankurga...@gmail.com wrote:
  nice find bhanu..though i didnt get much :P on first read :D :D
 
  On Tue, Sep 20, 2011 at 4:34 AM, Bhanu Kishore bhanukishor...@gmail.com
 wrote:
 
 
 
 
 
 
 
   See this algorithm:
  http://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_string_matching_alg.
 ..
 
   --
   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.




-- 
Nice Day

Abhishek Sharma
Bachelor of Technology
IIT Kanpur (2009)

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

2011-10-04 Thread abhishek sharma
Hi Don,

How is your method better than backtracking?

i hope you are implementing a sudoku solver..

Let me know.

Regds.

On Tue, Oct 4, 2011 at 10:42 PM, Don dondod...@gmail.com wrote:

 When you say Simulate Sudoku, do you mean solve a given Sudoku
 problem?

 Here is an overview of how I did that:

 I used an array of 81 integers to represent the board.
 Then I built a 27x9 table of all the groups: 9 rows, 9 columns, and 9
 squares.
 Then I built a 81x3 map which relates each location on the board to
 the 3 groups it belongs to.
 I maintain an array of 27 integers called avail whose bits indicate
 which values are still needed in that group.

 Read in the given values and update avail accordingly.

 Then repeatedly do the following until the problem is solved
   For each empty cell
   Compute the bitwise AND of the avail values for the 3 groups it
 belongs to.
   If the AND is zero, no value can go there. Return failure.
   If exactly one value can go there, put it there and update the
 avail values for the 3 groups
   If the loop above did not fill in any cells, then do the following
   Loop at each of the 27 groups
   For each value missing in that group, count the locations
 where it could go
   If it could go in exactly one location, put it there
   If it cannot go in any location, return failure.
   If the neither method above filled in any cells, then do the
 following:
   Pick the empty cell with the fewest possible values
   Try the possible values in that cell until you find one which
 allows the puzzle to be completed

 If the puzzle is solvable, this will solve it in a fraction of a
 second.

 Don

 On Oct 4, 9:21 am, himanshu kansal himanshukansal...@gmail.com
 wrote:
  can anybody give me the steps you need to check while writing a
  program to simulate sudoku
 
  i don't want the exact codejust algorithm would me more than
  sufficient.
 
  suggest also the suitable languages for implementing that..VB or
  java or any other

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




-- 
Nice Day

Abhishek Sharma
Bachelor of Technology
IIT Kanpur (2009)

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

2011-09-28 Thread abhishek iyer
http://www.fileserve.com/file/eBgSThF/How%20To%20Prepare%20For%20Qt%20Apt%20For%20Cat%202E%20By%20Sharma.pdf


On Tue, Sep 27, 2011 at 4:23 AM, SHUBHAM BANSAL
shubham.bans...@gmail.comwrote:

 If anyone have E-book of Quantative Aptitude For CAT by Arun Sharma.??
 Then kindly send to my email.or send me link if any 1 hav..Shubham
 bansal
 contact no. 7206338328
 NIT Kurukshetra
 Computer Engineering
 (Final year)

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




-- 
Thanks  Regards
Abhishek Iyer

If You Obey All the Rules, You Will Miss All the Fun. 

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

2011-09-26 Thread abhishek

a file is given containing lots of records seprated by new line
(records can be repeat)
and a substring given for egabc

now check for the record which contains the substring
and print top 10 record according to their frequency

derive algo with complexity o(n)

On Sep 26, 10:58 am, htross htb...@gmail.com wrote:
 can u explain more on the coding  question u solved?

 On Sep 26, 9:08 am, aditya kumar aditya.kumar130...@gmail.com wrote:







  I cleared the written round, the next round was coding round.

  We were asked to select any one problem out of three in 2 hrs.

  Q1) Given n number of xml files find a particular word and output should
  list all the files in current directory that contains that word.

  Q2) Given a hierarichal structure i.e., you have a parent class, a child
  class which extends a parent class which has some attributes and methods.
  You need

  to parse the structure and output should give you the set of the base class,
  set of derived class, set of attribute set and the set of method.

  Q3) Input - India is a great country. Key(alphanumeric) - B2. You have to
  encrypt the given sentence, in such a way that only the words should be
  jumbled.

  Output - great India a is country. While decrypting it, you have to use the
  same alpha numeric key and we should be able to get the same original
  string,

  i.e., India is a great country.

  I opted for the 3rd question, I used an array to store the starting offset
  of a word and i used key to shuffle the offset. i used hash function which
  takes

  the key and according the key value it shuffles the set of offsets while
  doing encryption. While decrypting i used the reverse method and i shuffled
  the same

  way to get back the original offset. After 2 hrs the external asked me to
  explain my logic, i explained each and every line and he was very much happy
  with

  the algorithm. He asked all the students to wait outside.

  They shortly announced the results for the next interview round.

  Technical round -1

  He asked me whether i was nervous, i told him frankly, yes sir a little bit.
  Then he motivated me by saying that you have done well in the previous
  rounds

  thats why you are here.

  Then he asked me to solve a problem. The problem was given a time in format
  of hh:mm we have to find the min angle between hr nd min hand.

  I answered him well and he was happy with that so he did not aske me to
  write the code.

  Second question - There is a system which continuously takes stream of data
  from one end, and from other end we want to retrive the particualr number
  is

  present in the system or not. Example - If you are retriving for 10 and if
  it is present then return the same number else return the closest value to
  that

  number. I used hashing then he asked me if I had a large input let us say in
  lakhs then hashing is not ideal approach. Then i told him that its better to
  use

  max heap. Then he said ok and before moving to next questions he told me
  that there are other better approach to this.

  He asked about my favourite subjects since i told my fav subject was OS, he
  started askimg me questions about OS.

  The questions were

  -Difference b/w semaphore and monitor

  -There are two threads, one produces even number and other produces odd
  number, how will you print the consecutive numbers.

  -What is semaphore and how will you implement it?

  -What is deadlock and what are 4 conditions of deadlock.

  -Simulate deadlock(Pictorial diagram).

  -Which data structure will you use for deadlock?

  I answered all the above questions so he was very much happy with it.

  Then and there he told me that i wont eliminate you in this round and would
  like to see you in next round.

  Technical round-2

  He asked me about my previous round experience and asked me to introduce
  myself for another 2/3 mins.

  He gave me a problem, there is a function which returns 0 or 1. You need to
  pass each and every element of the array one by one to that function and

  depending on the return value, you need to store all the numbers in such a
  way that all the true values should appear first and all the false value
  should

  appear last. After thinking for some time i came up with O(n) solution, he
  asked me to future optimze it. Within 2 mins he moved on to next question.

  Next question was a puzzle about aliens.

  Third question was about the real life example of stack.

  Fourth question was how the internet works as i told that OS and networking
  was my strong subject.

  Fifth question was how will you implement tree in real life example.

  He asked me to wait outside for the result.

  I got elimiated in that round and the next was HR round.

  On Sun, Sep 25, 2011 at 9:06 PM, Aditya Virmani 
  virmanisadi...@gmail.comwrote:

   neone who has appeared for yahoo recently? can ne one mention thr i/w /
   written rounds experience; they visited dce 3 days back  also nit
   

[algogeeks] Re: request of ebook..(Data Structures and algorithms made easy:)

2011-09-26 Thread abhishek
@ shady i appreciate you
but can't resist myself as i barely need it
so plz mail me as well

On Sep 26, 4:25 pm, shady sinv...@gmail.com wrote:
 if someone is having the book, he/she will not specifically mail it to each
 and everyone of you... rather to the mailing list.. so stop sending these
 mails
 if (you have the book)
  then mail
 else
  do nothing







 On Mon, Sep 26, 2011 at 4:35 PM, sahil sharma sahil18...@gmail.com wrote:
   pls send me d book too

        really need it

  thanks
  regards
   sahil

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

2011-09-26 Thread abhishek
c,c++ ,java

On Sep 26, 4:15 pm, Akash Mukherjee akash...@gmail.com wrote:
 any language pref?? are bash solns acceptable??







 On Mon, Sep 26, 2011 at 12:04 PM, abhishek abhishek.ma...@gmail.com wrote:

  a file is given containing lots of records seprated by new line
  (records can be repeat)
  and a substring given for egabc

  now check for the record which contains the substring
  and print top 10 record according to their frequency

  derive algo with complexity o(n)

  On Sep 26, 10:58 am, htross htb...@gmail.com wrote:
   can u explain more on the coding  question u solved?

   On Sep 26, 9:08 am, aditya kumar aditya.kumar130...@gmail.com wrote:

I cleared the written round, the next round was coding round.

We were asked to select any one problem out of three in 2 hrs.

Q1) Given n number of xml files find a particular word and output
  should
list all the files in current directory that contains that word.

Q2) Given a hierarichal structure i.e., you have a parent class, a
  child
class which extends a parent class which has some attributes and
  methods.
You need

to parse the structure and output should give you the set of the base
  class,
set of derived class, set of attribute set and the set of method.

Q3) Input - India is a great country. Key(alphanumeric) - B2. You have
  to
encrypt the given sentence, in such a way that only the words should be
jumbled.

Output - great India a is country. While decrypting it, you have to
  use the
same alpha numeric key and we should be able to get the same original
string,

i.e., India is a great country.

I opted for the 3rd question, I used an array to store the starting
  offset
of a word and i used key to shuffle the offset. i used hash function
  which
takes

the key and according the key value it shuffles the set of offsets
  while
doing encryption. While decrypting i used the reverse method and i
  shuffled
the same

way to get back the original offset. After 2 hrs the external asked me
  to
explain my logic, i explained each and every line and he was very much
  happy
with

the algorithm. He asked all the students to wait outside.

They shortly announced the results for the next interview round.

Technical round -1

He asked me whether i was nervous, i told him frankly, yes sir a little
  bit.
Then he motivated me by saying that you have done well in the previous
rounds

thats why you are here.

Then he asked me to solve a problem. The problem was given a time in
  format
of hh:mm we have to find the min angle between hr nd min hand.

I answered him well and he was happy with that so he did not aske me to
write the code.

Second question - There is a system which continuously takes stream of
  data
from one end, and from other end we want to retrive the particualr
  number
is

present in the system or not. Example - If you are retriving for 10
  and if
it is present then return the same number else return the closest value
  to
that

number. I used hashing then he asked me if I had a large input let us
  say in
lakhs then hashing is not ideal approach. Then i told him that its
  better to
use

max heap. Then he said ok and before moving to next questions he told
  me
that there are other better approach to this.

He asked about my favourite subjects since i told my fav subject was
  OS, he
started askimg me questions about OS.

The questions were

-Difference b/w semaphore and monitor

-There are two threads, one produces even number and other produces odd
number, how will you print the consecutive numbers.

-What is semaphore and how will you implement it?

-What is deadlock and what are 4 conditions of deadlock.

-Simulate deadlock(Pictorial diagram).

-Which data structure will you use for deadlock?

I answered all the above questions so he was very much happy with it.

Then and there he told me that i wont eliminate you in this round and
  would
like to see you in next round.

Technical round-2

He asked me about my previous round experience and asked me to
  introduce
myself for another 2/3 mins.

He gave me a problem, there is a function which returns 0 or 1. You
  need to
pass each and every element of the array one by one to that function
  and

depending on the return value, you need to store all the numbers in
  such a
way that all the true values should appear first and all the false
  value
should

appear last. After thinking for some time i came up with O(n) solution,
  he
asked me to future optimze it. Within 2 mins he moved on to next
  question.

Next question was a puzzle about aliens.

Third question was about the real life example of stack.

Fourth question was how the internet works as i told that OS and
  networking
was my

[algogeeks] Re: Yahoo! visit

2011-09-26 Thread abhishek
here is the process of paypal/ebay india

written test ---40 ques in 60 min (no negative marking)
 interview 1
interview 2
HR interview


written was a mix of technical and aptitude question

interview 1
first asked me about my hobby and discussed about 5 to 10 min on it
discussed on project
asked me to draw some diagrams related to project
and asked to implement the class patient (as my project was hospital
management system)
then question on traversing the link list

interview 2
asked 3 puzzle on time and distance
friend class concept
reversing a string without using any temporary variable
a question on link list from the written test

and there was no HR interview for me
BTW this was just formality
they were checking comm skill and willingness to join
On Sep 23, 7:17 pm, vartika aggarwal vartika.aggarwa...@gmail.com
wrote:
 If anyone has any idea about the process of Ebay and/or Yahoo! (especially
 the questions asked), kindly post it here soon...it's visiting our campus on
 Sunday..
 Please help!

 --
 Regards

 Vartika Aggarwal
 Undergraduate Student
 IT Department
 NSIT, Dwarka

-- 
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] without using '-'

2011-09-26 Thread Abhishek Gupta
thats basically taking twos' compliment and converting it to negative one
and then adding it..its the same principle...which is used for dividing two
numbers without using '/' and '-'...right kunal??

On Mon, Sep 26, 2011 at 10:38 PM, Ashima . ashima.b...@gmail.com wrote:

 grt.we never generally use ~ operator. got to knw abt it.
 Ashima
 M.Sc.(Tech)Information Systems
  4th year
 BITS Pilani
 Rajasthan




 On Mon, Sep 26, 2011 at 10:07 AM, ~*~VICKY~*~ venkat.jun...@gmail.comwrote:

 Tricky question with more tricky answers. thank you all.


 On Mon, Sep 26, 2011 at 9:55 PM, Kunal Yadav kunalyada...@gmail.comwrote:

 difference = x+ ~y +1

 On Mon, Sep 26, 2011 at 7:33 PM, ~*~VICKY~*~ venkat.jun...@gmail.comwrote:

 Find the difference of two numbers without using '-' operator !

 plz share ur solutions!

 --
 Cheers,

   Vicky

  --
 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
 Kunal Yadav
 (http://sourcebit.in)


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




 --
 Cheers,

   Vicky

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




-- 
Thanks  Regards
Abhishek Gupta

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

2011-09-25 Thread abhishek
process was
 written test
technical interview 1
tech interview 2

coading round

disscussion /improvement in coading

On Sep 26, 9:08 am, aditya kumar aditya.kumar130...@gmail.com wrote:
 I cleared the written round, the next round was coding round.

 We were asked to select any one problem out of three in 2 hrs.

 Q1) Given n number of xml files find a particular word and output should
 list all the files in current directory that contains that word.

 Q2) Given a hierarichal structure i.e., you have a parent class, a child
 class which extends a parent class which has some attributes and methods.
 You need

 to parse the structure and output should give you the set of the base class,
 set of derived class, set of attribute set and the set of method.

 Q3) Input - India is a great country. Key(alphanumeric) - B2. You have to
 encrypt the given sentence, in such a way that only the words should be
 jumbled.

 Output - great India a is country. While decrypting it, you have to use the
 same alpha numeric key and we should be able to get the same original
 string,

 i.e., India is a great country.

 I opted for the 3rd question, I used an array to store the starting offset
 of a word and i used key to shuffle the offset. i used hash function which
 takes

 the key and according the key value it shuffles the set of offsets while
 doing encryption. While decrypting i used the reverse method and i shuffled
 the same

 way to get back the original offset. After 2 hrs the external asked me to
 explain my logic, i explained each and every line and he was very much happy
 with

 the algorithm. He asked all the students to wait outside.

 They shortly announced the results for the next interview round.

 Technical round -1

 He asked me whether i was nervous, i told him frankly, yes sir a little bit.
 Then he motivated me by saying that you have done well in the previous
 rounds

 thats why you are here.

 Then he asked me to solve a problem. The problem was given a time in format
 of hh:mm we have to find the min angle between hr nd min hand.

 I answered him well and he was happy with that so he did not aske me to
 write the code.

 Second question - There is a system which continuously takes stream of data
 from one end, and from other end we want to retrive the particualr number
 is

 present in the system or not. Example - If you are retriving for 10 and if
 it is present then return the same number else return the closest value to
 that

 number. I used hashing then he asked me if I had a large input let us say in
 lakhs then hashing is not ideal approach. Then i told him that its better to
 use

 max heap. Then he said ok and before moving to next questions he told me
 that there are other better approach to this.

 He asked about my favourite subjects since i told my fav subject was OS, he
 started askimg me questions about OS.

 The questions were

 -Difference b/w semaphore and monitor

 -There are two threads, one produces even number and other produces odd
 number, how will you print the consecutive numbers.

 -What is semaphore and how will you implement it?

 -What is deadlock and what are 4 conditions of deadlock.

 -Simulate deadlock(Pictorial diagram).

 -Which data structure will you use for deadlock?

 I answered all the above questions so he was very much happy with it.

 Then and there he told me that i wont eliminate you in this round and would
 like to see you in next round.

 Technical round-2

 He asked me about my previous round experience and asked me to introduce
 myself for another 2/3 mins.

 He gave me a problem, there is a function which returns 0 or 1. You need to
 pass each and every element of the array one by one to that function and

 depending on the return value, you need to store all the numbers in such a
 way that all the true values should appear first and all the false value
 should

 appear last. After thinking for some time i came up with O(n) solution, he
 asked me to future optimze it. Within 2 mins he moved on to next question.

 Next question was a puzzle about aliens.

 Third question was about the real life example of stack.

 Fourth question was how the internet works as i told that OS and networking
 was my strong subject.

 Fifth question was how will you implement tree in real life example.

 He asked me to wait outside for the result.

 I got elimiated in that round and the next was HR round.

 On Sun, Sep 25, 2011 at 9:06 PM, Aditya Virmani 
 virmanisadi...@gmail.comwrote:







  neone who has appeared for yahoo recently? can ne one mention thr i/w /
  written rounds experience; they visited dce 3 days back  also nit
  surathkal...

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

[algogeeks] Re: THANX ALGOGEEKS !!!!!!

2011-09-22 Thread abhishek
congrats dude

hope u will be well connected with this group and help others to
achieve their goals

On Sep 22, 8:29 am, saurabh sah.saurab...@gmail.com wrote:
 I sincerely thank this group as i got selected in Microsoft IDC only
 because
 of this group .

 It was a wonderful experience for me at the interviews because the
 some of questions were closely related to the questions discussed
 here . And i also got to know about book Crackin the Coding
 Interviews which is more than sufficient for any company interviews
 from this group only .

 Finally i thank all those group members who shared their experiences
 and others who replied to their queries .
 GOOD LUCK to all

 Saurabh Sah
 Final Year, B.Tech
 MNIT JAIPUR

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

2011-09-22 Thread Abhishek Goswami
I have seen code and output but I think it should be 7965 am i right? if you
are looking for first largest

On Thu, Sep 22, 2011 at 12:46 AM, Anil Arya anilarya...@gmail.com wrote:

 http://ideone.com/pmil8


 On Thu, Sep 22, 2011 at 12:46 AM, Anil Arya anilarya...@gmail.com wrote:

 @kartik
 Is it right


 On Wed, Sep 21, 2011 at 10:24 PM, kartik sachan 
 kartik.sac...@gmail.comwrote:

 obivously it will be first largest 

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




 --
 *Anil  Arya,
 Computer Science *
 *Motilal Nehru National Institute of Technology,Allahabad .
 *





 --
 *Anil  Arya,
 Computer Science *
 *Motilal Nehru National Institute of Technology,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.



[algogeeks] yahoo question

2011-09-21 Thread abhishek
You have given a number 123456789 and two opearators + and *. You can
use this two operators as many times u want. But you cant change the
sequence of the number given there. The evaluated value is 2097.

e.g. 1+2+345*6+7+8+9=2097


You have to find all the such expressions that evaluates and value is
equal to the given value. You can use concatenation of numbers like
345 is concatenated there.

Please remember that You have to find all Such expressions. And write
C/C++/Java code 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.



[algogeeks] Re: yahoo question

2011-09-21 Thread abhishek
DCE
i am also want to know recruitment process as it is coming on 23rd.

On Sep 21, 7:52 pm, Simran Singh sammy.4...@gmail.com wrote:
 Hey.. Which college you from..?? And please do tell more about their
 process..









 On Wed, Sep 21, 2011 at 7:31 PM, abhishek abhishek.ma...@gmail.com wrote:
  You have given a number 123456789 and two opearators + and *. You can
  use this two operators as many times u want. But you cant change the
  sequence of the number given there. The evaluated value is 2097.

  e.g. 1+2+345*6+7+8+9=2097

  You have to find all the such expressions that evaluates and value is
  equal to the given value. You can use concatenation of numbers like
  345 is concatenated there.

  Please remember that You have to find all Such expressions. And write
  C/C++/Java code 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.

 --
 Simran Singh
 Under Graduate student,
 Computer Engineering,
 Netaji Subhas Institute Of Technology,
 Dwarka Sec-3, Delhi-78
 (M): +91-9811699512

-- 
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] ftell problem

2011-09-20 Thread Abhishek Gupta
Guys

what is the difference between ftell(fp)1 and ftell(fp) 0??


...
Abhishek Gupta

-- 
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: c output

2011-09-19 Thread abhishek
output is
 18 9 0
0
0
8

the same was expected.

printf uses stack when it has multiple arguments to print
On Sep 18, 1:19 pm, Bhavesh agrawal agr.bhav...@gmail.com wrote:
 another que..

 #includestdio.h
 main()
 {
     int a;
     int i=10;
     printf(%d %d %d\n,i+++i,i,i---i);
     printf(%d\n,i---i);
     a=i---i;
     printf(%d \n%d,a,i);
     return 0;

 }

 output:

 18 10 0
 0
 0
 8

 how ??

-- 
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: c output

2011-09-19 Thread abhishek
@ sukran
if it is giving same ans then there  has to be some reason,

On Sep 19, 12:45 pm, sukran dhawan sukrandha...@gmail.com wrote:
 common guys its undefined acc to standard c 

 On Mon, Sep 19, 2011 at 12:36 PM, Siddhartha Banerjee 







 thefourrup...@gmail.com wrote:
  on running,every time i get  second a=30... any reasons 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] binary tree

2011-09-18 Thread abhishek sharma
hi prasanth,

i was asked a similar ques but with the condition that path shud terminate
at a leaf node  u just have to return true if you are able to find a path.

what i did was,
- do an inorder traversal (u have to pass a parameter that represents
sum as well along with treenode pointer)
- at every leaf check the value of cumulative sum of all the parents'
data and the current node's data

for printing paths u can use a stack



On Sun, Sep 18, 2011 at 2:26 PM, prasanth n nprasnt...@gmail.com wrote:

 You are given a binary tree in which each node contains a value. Design an
 ALGORITHM to print all paths which sum up to that value. Note that it can be
 any path in the tree - it does not have to start at the root.

 --
 *prasanth*

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




-- 
Nice Day

Abhishek Sharma
Bachelor of Technology
IIT Kanpur (2009)

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



  1   2   3   >