[algogeeks] Java Design Question..

2012-08-02 Thread teja bala
I had a java class(acts as a database class) which got a method which
returns the respective object of the class based on given data(instance
variable) .. eg: given customer id and 3 classes clerk,manager,salesperson
like that .. method should return the instance associated with the customer
id..
can anyone suggest how to approach this??

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 recursion Question !!

2012-07-27 Thread teja bala
thx alot

How silly my mistake was!! :( ...

On Thu, Jul 26, 2012 at 11:16 PM, payal gupta gpt.pa...@gmail.com wrote:

 perhaps its this quoted line...

  permu(c,i+1,j);   permu(c,i+1,n)

 On Thu, Jul 26, 2012 at 9:37 PM, teja bala pawanjalsa.t...@gmail.comwrote:

 // plz anyone tell me whats wrong in this code
 //o/p should print all possible permutations of string.

 class swap
 {
  char ab[]={'a','b','c'};
  public static void main(String[] args)
 {
 swap c=new swap();
  permu(c.ab,0,3);
 }
 public static void permu(char c[],int i,int n)
  {
 System.out.print(i);int j;
 if(i==n){ for( char ch:c)System.out.print(ch);}
  else
 {
 for(j=i;jn;j++)
  {
 swaps(c[i],c[j]);
 permu(c,i+1,j);
  swaps(c[i],c[j]);
 }
  }
 }
 public static void swaps (char x,char y)
  {
 char temp1=x;
 x=y;
  y=temp1;
 }
 }

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] Java recursion Question !!

2012-07-26 Thread teja bala
// plz anyone tell me whats wrong in this code
//o/p should print all possible permutations of string.

class swap
{
 char ab[]={'a','b','c'};
public static void main(String[] args)
{
swap c=new swap();
 permu(c.ab,0,3);
}
public static void permu(char c[],int i,int n)
{
System.out.print(i);int j;
if(i==n){ for( char ch:c)System.out.print(ch);}
else
{
for(j=i;jn;j++)
{
swaps(c[i],c[j]);
permu(c,i+1,j);
swaps(c[i],c[j]);
}
}
}
public static void swaps (char x,char y)
{
char temp1=x;
x=y;
y=temp1;
}
}

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

2012-03-06 Thread teja bala
VCE hyderabad

On Mon, Mar 5, 2012 at 3:28 PM, adarsh kumar algog...@gmail.com wrote:

 Which college?

 On Sun, Mar 4, 2012 at 10:16 AM, teja bala pawanjalsa.t...@gmail.comwrote:

 Google is visiting our campus 4 different roles As  of now IT field
 technician is confirmed so how to approach 4 written test. ??

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

2012-03-03 Thread teja bala
Google is visiting our campus 4 different roles As  of now IT field
technician is confirmed so how to approach 4 written test. ??

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: difference b/w static global variables and global variables

2012-02-27 Thread teja bala
As we all know about data organisation structure in c like stack area,heap
area and un intialized data segment 

so wen uninitialized global variable will be allocated memory in
unitialized data segment but static variable ll be local to entire
file,initialized to 0 and kept in heap area mostly but if any recursive
calls associated with dat particular variable den stack segment is
used..

hope it xplains

Regards,
MOZHI.
On Mon, Feb 27, 2012 at 8:46 PM, Don dondod...@gmail.com wrote:

 In addition to the difference in scope, the standard requires that
 static variables be initialized to zero by default. Global variables
 are not required to be initialized by default.
 Don

 On Feb 25, 10:51 am, AMAN AGARWAL mnnit.a...@gmail.com wrote:
  Hi ,
 
  Is there any difference b/w static global variables and global variables
 ???
 
  (apart from that static variables will be limited to that file only and
  global variables will be visible for other files also.)
 
  Regards,
  Aman.
 
  --
  AMAN AGARWAL
  Success is not final, Failure is not fatal: It is the courage to
 continue
  that counts!

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] C QUESTION???

2012-01-06 Thread teja bala
## concatenating operator

On Sat, Jan 7, 2012 at 9:01 AM, UTKARSH SRIVASTAV
usrivastav...@gmail.comwrote:

 yes payal read a standard c book like dennis ritchie ... these are the
 best source


 On Sat, Jan 7, 2012 at 1:53 AM, payal gupta gpt.pa...@gmail.com wrote:

 @parag thnx...
 btw is dere ny source dat has ny info bout it??

 Regards,
 Payal Gupta,
 3rd year,
 NIT-Bhopal


 On Sat, Jan 7, 2012 at 12:36 AM, parag khanna 
 khanna.para...@gmail.comwrote:



 On Sat, Jan 7, 2012 at 12:36 AM, parag khanna 
 khanna.para...@gmail.comwrote:


 it joins the variables together ... for eg 1##2 = 12 or a##b=ab








 --
 *Parag Khanna
 B.tech Final Year
 NIT,Kurukshetra*




 --
 *Parag Khanna
 B.tech Final Year
 NIT,Kurukshetra*

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




 --
 *UTKARSH SRIVASTAV
 CSE-3
 B-Tech 3rd Year
 @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] C output????

2012-01-05 Thread teja bala
depends on compiler i think..but most probably it compares the
addresses.

On Wed, Jan 4, 2012 at 12:20 PM, saurabh singh saurab...@gmail.com wrote:

 @all.Your explanations work because probably all of you are using a
 compiler that's behaving in the same way.Don't conclude from what you
 see...The compiler is free to store the constant strings the way it
 wants.
 Saurabh Singh
 B.Tech (Computer Science)
 MNNIT
 blog:geekinessthecoolway.blogspot.com



 On Wed, Jan 4, 2012 at 12:13 PM, Rahul raikra...@gmail.com wrote:

 it's near to a common mis conception that string liberals are in data
 sections of THE PROGRAM


 PLEASE READ THE FILE
 a.out.h

 and find the difference between initialized data and non initialized data

 On 9/6/11, Sandy sandy.wad...@gmail.com wrote:
  String constants (literals) are saved into the .data section of the
 program,
   Here is the sample program to show that.  if() is essentially
 comparing the
  addresses of two pointers which is same.
 
  int main()
  {
  char *p=persons;
  char *q=persons;
  char *r=persons;
  char *s=persons;
   printf(%x %x %x %x\n,p,q,r,s);
  if(p==persons)
  printf(technical %s,p);
  else
  printf(true %s,p);
  return 0;
  }
  -
  Output:
  403021 403021 403021 403021
  technical persons
 
  On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s sivavikne...@gmail.com
 wrote:
 
 
  main()
  {
  char *p=persons;
  clrscr();
  if(p==persons)
  printf(technical %s,p);
  else
  printf(true %s,p);
  return 0;
  }
 
  ..op : technical persons ..plz explain .. how come it works like an
 strcmp
  operation???
  --
  Regards,
  $iva
 
   --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
 
 
  --
 
  *Sandeep Kumar,*
   ( Mobile +91-9866507368
 
  *“I believe in smart work, Believe 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.


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

2011-10-31 Thread teja bala
+1 abhishek

On Mon, Oct 31, 2011 at 6:26 PM, abhishek kumar abhi5...@gmail.com wrote:

 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.


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

2011-10-30 Thread teja bala
*STEP-1*
Construct a self balancing Binary Search Tree where in the nodes represents
the elements of the given set..
*STEP-2*
   Depending on the K (no. of partitions) keep a counter k
*STEP_3*
*  * If BST not empty continue to Step-4 else exit with failure..
*STEP-4*
 And while doing any traversal  technique on BST keep on decrement  the k
value and display the node values and delete them .
*STEP-5*
 Once the first set is displayed again initialize k value and repeat Step-3


On Sun, Oct 30, 2011 at 6:41 PM, SAMMM somnath.nit...@gmail.com wrote:

 An array is given consisting of real integers , can hav  repeatative
 elements , Now u need to find K partitions whose union will hav all
 the elements of the array ,  but the intersection of any pair of
 cannot hav K elements in common.

 Exam:-
 Array- 1 1 2  2 3 1 4 3 5

 For K=3 the partition are :-
 (1 2 3) (1 5 2) (1 4 3)


 cann't be :- (1 2 3)(3 1 2)(1 4 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.



Re: [algogeeks] Finding connection b/w 2 profiles

2011-10-29 Thread teja bala
I think we could use Algorithm A* where in subgraph(G) maintains all the
paths to the required profile and subtree(Tr) gives us the optimal
path..

On Tue, Sep 13, 2011 at 5:43 PM, JITESH KUMAR jkhas...@gmail.com wrote:

 Suppose you are visiting someone's profile in fb or linkedin, you get to
 know how you are connected to that person.
 e.g. Suppose you are visiting C's profile. you get a suggestion like you
 are connected to him via A-B-C.
 Tell efficient way to solve this problem( apart from Brute Force).

 --
 *Regards
 Jitesh Kumar*

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


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



Re: [algogeeks] Minimize bins

2011-10-29 Thread teja bala
Greedy knapsack algorithm will work fine in this case as in each bin

n1s1+n2s2+..nrsr=C gives the optimal solution...

On Sat, Oct 29, 2011 at 4:34 AM, SAMMM somnath.nit...@gmail.com wrote:

 Suppose u have n1 items of size s1,
 n2 items of size s2 and n3 items of size s3. You'd like to pack
 all of these items into bins each of capacity C, such that the
 total number of bins used is minimized.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] Frequency of number

2011-09-27 Thread teja bala
If we are to find frequency of only one number let us say 35 in infinite
coming numbers , do xor operation with coming numbers If the result is 0
increment the value of temp variable by 1 if not scan next input until all
numbers are over.

On Tue, Sep 27, 2011 at 10:22 PM, Ankuj Gupta ankuj2...@gmail.com wrote:

 Infinite numbers are coming in a stream .  how will you find the
 frequency of a 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.



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: sqrt function...

2011-09-25 Thread teja bala
@vikram

the one which i posted(link) it was newton raphson method which is used to
derive the square root of a number , there are many other methods if u r
interested visit wikipedia ,
and coming to this method write the code and xplain to him with an
xample...

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

2011-09-25 Thread teja bala
do dfs traversal along the two log files and maintain a stack in which push
the element from 1st log file and if matching id in 2 log file is found pop
it and display it to user
but dis 'll take extra stack space ,,,

another sol.. maintain a bit array for any of the log file and while doing
BFS traversal if any nth  common id found set the nth bit in bit array and
thus retrieving the data where the bit is set

On Mon, Sep 26, 2011 at 1:32 AM, khushboo lohia khushl...@gmail.com wrote:

 Are the customer id's in 2 files in sorted order ?


 On Mon, Sep 26, 2011 at 1:29 AM, Ankur Garg ankurga...@gmail.com wrote:

 You are given 2 log files each having 1 billion entries and each entry has
 a unique customer id.You need to print the records in two files which are
 common.



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

2011-09-24 Thread teja bala
What is the efficient way to sort a M*N matrix.

eg: Given a 3*4 matrix

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

The ouput should be

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

Matrix may contain duplicates..

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: sqrt function...

2011-09-24 Thread teja bala
http://www.geeksforgeeks.org/archives/3187


check dis one.

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

2011-09-22 Thread teja bala
congrats dude

On Thu, Sep 22, 2011 at 12:46 PM, Suraj Fale surajfa...@gmail.com wrote:

 Congrats !!!1




 --
 Regards
 Suraj Fale
 +91-9766103115

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

2011-09-21 Thread teja bala
Where can we use function pointers in C, what are the uses of function
pointers?

come up with new one not like callback , qsort etc...

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

2011-09-21 Thread teja bala
@ ravi but compile it on http://ideone.com/nkTVN  it showing 45 hello plz do
look at it...

On Thu, Sep 22, 2011 at 12:59 AM, Rashmi Jain rashmi.jain...@gmail.comwrote:

 @ravi: thanks..!!


 On Thu, Sep 22, 2011 at 12:54 AM, ravi maggon maggonr...@gmail.comwrote:

 ohh sorry, I thought it was i=9. Yes only 9 times Hello will be printed.

 On Thu, Sep 22, 2011 at 12:52 AM, Rashmi Jain 
 rashmi.jain...@gmail.comwrote:

 @ravi
 can u plz explain how 10 processes are created..? shouldn't it be 9..??

 On Thu, Sep 22, 2011 at 12:23 AM, ravi maggon maggonr...@gmail.comwrote:

 Output Hello printed 10 times. Since form command spawns the process, so
 for every call their are two process created and since if process gets
 successfully created fork returns some positive no. which is the process 
 id,
 so it will break the loop and finally only the 10 child processes will be
 left which will print Hello 10 times. I hope that I cleared your doubt.


 On Thu, Sep 22, 2011 at 12:03 AM, Anil Arya anilarya...@gmail.comwrote:

 http://ideone.com/nkTVN


 On Wed, Sep 21, 2011 at 11:43 PM, Saravana kumar 
 saravana@gmail.com wrote:

 Hello will be printed 45 times...


 On Wed, Sep 21, 2011 at 7:57 PM, sush57 sushaant...@gmail.comwrote:

 main()
 {
int tmp;
for(i=0;i9;i++)
{
tmp=fork();
if(tmp0)
break;
printf(Hello);
}
 }


 what's the output and how does this work

 can u give few other questions using fork...

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




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




 --
 Regards
 Ravi Maggon
 B.E. CSE, Final Year
 Thapar University

 www.algorithmguru.com

 *Failure is the opportunity to begin again more intelligently*

  --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
 Ravi Maggon
 B.E. CSE, Final Year
 Thapar University

 www.algorithmguru.com

 *Failure is the opportunity to begin again more intelligently*

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] Design Approach query

2011-09-20 Thread teja bala
Write a design for formatting program similar to MS word. It takes
input test and formats it in paragraphs, lines . Every line should
occupy same width it has to be adjusted by increasing/ decreasing
number of spaces between the words ?

Discuss design issues?

(How to approach dis kind of queries)

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

2011-09-19 Thread teja bala
Guys does any one have idea about MAQ's written  recruitment
interview process plzz let me know..
Wat are the possible questions that come in written and interview plzz
post dem?



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] Directi Questions - needed answers

2011-09-19 Thread teja bala
5 ans-C

reference http://en.wikipedia.org/wiki/Reentrant_(subroutine)

On Sat, Sep 17, 2011 at 9:11 AM, VIHARRI viharri@gmail.com wrote:

 1. Minimum no.of comparisons required to select the 2nd max element in
 an array of N numbers.

 2. What are the number of counting ties for four horses. ( example for
 two horses A and B there are three cases - A wins, B wins, A  B
 ties ).

 3. What are the minimum no.of tournaments needed to get the winner. A
 player is out when he loses two matches. Total players are 51.
 ( Badminton ).

 4. while(true)
{
 sleep 1sencond;
 if( getpid() % 2 == 0 )
 {
 fork();
 }
   }
 How many no.of processes are created by the end of 12th second, if
 time starts from 0th second? Process id's start from 0.

 5. Which of the following are thread safe?
 a) Atomic operations
 b) Mutual exclusion
 c) Re-entrant
 d) Queuing

 6. When a dice is rolled the outcome of the face is summed up each
 time, and rolling is stopped when the sum becomes greater than 100.
 Which of the following have more probability to become sum.
 a) 103
 b) 102
 c) 100
 d) all have equal probability
 e) 101

 7. A man moves 1km east, 2km north, 3km west, 4km south, 5km east, 6km
 north, 7km west and so on until he travels total of 300km so what
 will be the distance from origin?

 8. Alam bought 5pens, 7 pencils, 4 erasers. Ashok bought 6 pens, 8
 erasers, 14 pencils and paid half more the amount Alam paid. What is
 the percentage of amount did Alam spent on buying pens?

 9. Time complexity to get min elements from MAX heap.

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



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



[algogeeks] C++ Query

2011-09-19 Thread teja bala
Why do we pass a reference for copy constructors?
 If it does shallow copy for pass by value (user defined object), how
will it do the deep copy?


Ans:- if we don't pass the reference, every time a new object copy
like

A a=b;

constructor will be called twice ,,

correct me if i'm wrong...

help me regarding about shallow copy and deep copy  in copy
constructor.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] C++ Query

2011-09-19 Thread teja bala
@praveen

how about shallow copy and deep copy of copy  constructor?

On Mon, Sep 19, 2011 at 6:53 PM, praveen raj praveen0...@gmail.com wrote:

 Yes u r saying correct .
 On 19-Sep-2011 6:39 PM, teja bala pawanjalsa.t...@gmail.com wrote:
  Why do we pass a reference for copy constructors?
  If it does shallow copy for pass by value (user defined object), how
  will it do the deep copy?
 
 
  Ans:- if we don't pass the reference, every time a new object copy
  like
 
  A a=b;
 
  constructor will be called twice ,,
 
  correct me if i'm wrong...
 
  help me regarding about shallow copy and deep copy in copy
  constructor.
 
  --
  You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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] C++ Query

2011-09-19 Thread teja bala
Does anyone can xplain Function object or functor in C++ with
example???


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

2011-09-19 Thread teja bala
// Could some body plzz xplain dis code..


#includestdio.h
void main()
{
long double lda=1e+37L,ldb=1e-37L;
long double a[2]={1234,5678};
long long unsigned int x=0x1234;
printf(%d  %d   %ld%ld  %llx
%d,sizeof(lda),lda,a[0],a[1],x,sizeof(x));
}

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Directi Questions - needed answers

2011-09-18 Thread teja bala
@Nithin Garg how 194 for the 4 question?

On Mon, Sep 19, 2011 at 12:26 AM, Nitin Garg nitin.garg.i...@gmail.comwrote:

 Answer  3 - 100
 Answer 6 - 103
 Answer 4 - 194 total processes including the parent
 Answer 7 - 12 km south, 12 km east


 On Sun, Sep 18, 2011 at 11:53 PM, Ashima . ashima.b...@gmail.com wrote:

 @malay: how cm n+logn-2?
 cn u explain the logic ?

 Ashima
 M.Sc.(Tech)Information Systems
 4th year
 BITS Pilani
 Rajasthan




 On Sun, Sep 18, 2011 at 11:07 AM, Ashima . ashima.b...@gmail.com wrote:

 rite! 62.5%

 Ashima
 M.Sc.(Tech)Information Systems
 4th year
 BITS Pilani
 Rajasthan




 On Sat, Sep 17, 2011 at 9:04 PM, malay chakrabarti 
 m1234...@gmail.comwrote:

 create a tournament tree.in each round one value is eliminated to
 obtain in the process the winner or the highest value in n-1 comparisons.
 Then check the queue of the winner which contains log(n) entries of the
 values beaten by the winner which implicitly will contain the runners
 up.Then log(n)-1 comparisons to find the highest among all the losers whom
 the winner had beaten. So all over complexity will be n-1 +log(n) -1 =
 n+log(n)-2. Hp that answers ur query. nice question btw :)


 On Sun, Sep 18, 2011 at 8:02 AM, VIHARRI viharri@gmail.com wrote:

 hey i'm also thinking n + logn -2.. but couldnt able to figure out
 how??? can you please explain the logic

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




 --
 Nitin Garg

 Personality can open doors... but only Character can keep them open

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


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



[algogeeks] C Puzzle

2011-09-17 Thread teja bala
 you have to print the list of all the files in a directory and all
its sub directories?

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



[algogeeks] C++ Query...

2011-09-15 Thread teja bala
How to access class private data members with a pointer?

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] C++ Query...

2011-09-15 Thread teja bala
@ BHARATH

exactly very thx

On Thu, Sep 15, 2011 at 5:22 PM, bharatkumar bagana 
bagana.bharatku...@gmail.com wrote:

 @teja : r u looking for something like this...
 #includestdio.h
 #includestdlib.h
 class Hai
 {
  public :
 int* getPointerToPrivate()
 {
 return i;
 }
 void setI(int j)
 {
 i=j;
 }
  private:
 int i;
 };
 main()
 {
  Hai h;
  h.setI(10);
  int *i=h.getPointerToPrivate();
  printf(%d,*i);

 }

 On Thu, Sep 15, 2011 at 6:41 AM, teja bala pawanjalsa.t...@gmail.comwrote:

 How to access class private data members with a pointer?

 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.




 --

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



[algogeeks] MS interview

2011-09-15 Thread teja bala
13. Propose an algo/data struct for memory manager.
14. Propose and algo/data struct for timer manager.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] MICROSOFT WRITTEN IN VASAVI

2011-09-14 Thread teja bala
dis was asked in MS written


U r given a string u need to print all cases of letters without
changing the order
eg:-
ABC,Abc,ABc,aBC,abC etc...

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 WRITTEN IN VASAVI

2011-09-14 Thread teja bala
@DAVE

dis was the o/p for ur prog.

aBC
abC
abC
abc
abc
abc
abc
abc

#includeiostream.h
main()
{
int i, n = 3;
char *s=ABC;
for( i = 0 ; i  (1n) ; ++i )
{
 s[i^(i1)] ^= 'a' ^ 'A';
 cout  s  endl;
}
}

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 WRITTEN IN VASAVI

2011-09-14 Thread teja bala
//dis one works check it out..

#includectype.h
#includestdio.h
#includestring.h
#includeassert.h
void toggler(char* x, int pos)
{
  if(pos==0){ printf(%s\n,x); return; }
//  printf(String is now: %s\n,x);
  x[pos-1] = toupper(x[pos-1]);
  toggler(x, pos-1);
  x[pos-1] = tolower(x[pos-1]);
  toggler(x, pos-1);
return;
}
int main(void){
  char str[500];
  scanf(%s,str);
  toggler(str, strlen(str));
  return 0;
}

On Wed, Sep 14, 2011 at 7:22 PM, Dave dave_and_da...@juno.com wrote:

 @Teja: Oops. I was wrong. By the time I fix my conceptual error, the
 code is no shorter than Anshu's.

 Dave

 On Sep 14, 8:14 am, teja bala pawanjalsa.t...@gmail.com wrote:
  @DAVE
 
  dis was the o/p for ur prog.
 
  aBC
  abC
  abC
  abc
  abc
  abc
  abc
  abc
 
  #includeiostream.h
  main()
  {
  int i, n = 3;
  char *s=ABC;
  for( i = 0 ; i  (1n) ; ++i )
  {
   s[i^(i1)] ^= 'a' ^ 'A';
   cout  s  endl;
 
 
 
  }
  }- 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.



[algogeeks] MAQ

2011-09-13 Thread teja bala
Guys does any one have an idea of MAQ placement procedure, if so
please post the tips and the respective links ,thanx in
advance.

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



Re: [algogeeks] ms question

2011-09-12 Thread teja bala
I think it is 1/N

let N=6 that means rand(6)= takes values 0-5 i.e 6 values.
rand(m)=6 values
rand(n)=6 values
total combinations 6*6=36 values set but among dem array will change only
for
(0,0)(1,1)(2,2)(3,3)(4,4)(5,5)(6,6)=6values of N

So 6/36=1/6

If we generalize it 1/N

correct me if i'm wrong?

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

2011-09-12 Thread teja bala
1-Write test cases for a new student registration form. The
registration form captures Student name, email address, Address, Date
of birth, Password. It also asks the student to confirm the password.

2-Consider that this application is being deployed as Web application
and Desktop application and deployed in multiple countries


Is der anything to do with Statement 2 in dis question.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Headstrong placement papers

2011-09-12 Thread teja bala
wat is d package?

On Mon, Sep 12, 2011 at 8:27 PM, sourabh jain sourabhjain...@gmail.comwrote:


 pls tell me ques/ans. if u remembered.









 --

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


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



Re: [algogeeks] Re: MICROSOFT in VJTI mumbai

2011-09-11 Thread teja bala
@KK

wat questions are there in Objective paper? I mean regarding which subject?

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

2011-09-11 Thread teja bala
//first one
#includestdio.h
main()
{
char *a=total;
int n=5;
int i,j,flag=1;
for(i=0;in;i++)
{
 for(j=0;jn  flag!=0;j++)
 {
  if(a[i]==a[j]  i!=j)break;
  else if(a[i]!=a[j]  j==n-1){ printf(%c,a[i]);flag=0; break;}
 }
}
}

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] MICROSOFT WRITTEN QUESTION-2010

2011-09-11 Thread teja bala
MERGE 2 BINARY SEARCH TREES?


HOW TO DO IT?(POST AN EFFICIENT ALGORITHM)

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



Re: [algogeeks] Re: microsoft interview

2011-09-11 Thread teja bala
//pseudo code dis  will work for sure.

for(i=0;irow_count;i++)
for(j=0;jcolumn_count;j++)
{
if (a[i][j] == 1)
{
a[i][0] = 1;
a[0][j] = 1;
}
}
for(i=1;irow_count;i++)
for(j=1;jcolumn_count;j++)
{
 if (a[0][j] == 1 || a[i][0] == 1)
 {
  a[i][j] = 1;
 }
]
if (a[0][0] == 1)
{
for (i=0;irow_count;i++)
{
 a[i][0] = 1;
}
for (i=0;icolumn_count;i++)
{
 a[0][i] = 1;
}

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



[algogeeks] C Puzzle

2011-09-11 Thread teja bala
#includestdio.h
main()
{
int *a;
char *c;
*a = 20;
*c = *a;
printf(%d %c,*a,*c);
}

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

2011-09-11 Thread teja bala
@Ishan

it is giving segmentation fault  ... wat it means? and  can u plz correct d
code...

On Mon, Sep 12, 2011 at 10:30 AM, Ishan Aggarwal 
ishan.aggarwal.1...@gmail.com wrote:

 *c = *a;
 It will result in an run-time error.


 On Mon, Sep 12, 2011 at 10:25 AM, teja bala pawanjalsa.t...@gmail.comwrote:

 #includestdio.h
 main()
 {
 int *a;
 char *c;
 *a = 20;
 *c = *a;
 printf(%d %c,*a,*c);
 }

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




 --
 Kind Regards
 Ishan Aggarwal
 [image: Aricent Group]
 Presidency Tower-A, M.G.Road,Sector-14
 Gurgaon,Haryana.122015 INDIA
 Phone : +91-9654602663
 ishan2.aggar...@aricent.com puneet.ar...@aricent.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.



[algogeeks] Data Structures

2011-09-11 Thread teja bala
struct n { int data; struct n* next}node;
node *c,*t;
c-data = 10;
t-next = null;
*c = *t;
what is the effect of the last statement?

Is dis correct?
My Ans:- c 'll point to node t which contains garbage value in data
field and link field a 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.



Re: [algogeeks] Data Structures

2011-09-11 Thread teja bala
@sukran

dis was asked in microsoft written ?

take node *c 'll create a new node like that

On Mon, Sep 12, 2011 at 11:00 AM, sukran dhawan sukrandha...@gmail.comwrote:

 pl tell me wat ur doin here... here u ve defined a variable node of type
 struct n.

 wat does the statement node *c ??? how can u create an instance of an
 instance ?

 On Mon, Sep 12, 2011 at 10:52 AM, teja bala pawanjalsa.t...@gmail.comwrote:

 struct n { int data; struct n* next}node;
 node *c,*t;
 c-data = 10;
 t-next = null;
 *c = *t;
 what is the effect of the last statement?

 Is dis correct?
 My Ans:- c 'll point to node t which contains garbage value in data
 fieldc and link field a 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.


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

2011-09-11 Thread teja bala
 If you're familiar with the ? operator x ? y : z
you have to implement that in a function: int cond(int x, int y, int
z); using only ~, !, ^, , +, |, ,  no if statements, or loops or
anything else, just those operators, and the function should correctly
return y or z based on the value of x. You may use constants, but only
8 bit constants. You can cast all you want. You're not supposed to use
extra variables, but in the end, it won't really matter, using
variables just makes things cleaner. You should be able to reduce your
solution to a single line in the end though that requires no extra
vars.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] MICROSOFT WRITTEN QUESTION

2011-09-10 Thread teja bala
 There are set of coins of {50,25,10,5,1} paise in a box.Write a
program to find the number of ways a 1 rupee can be created by
grouping the paise.



post ur code.

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



Re: [algogeeks] MICROSOFT WRITTEN QUESTION

2011-09-10 Thread teja bala
@Gaurav

wat if here is n=1
den
 W(0)=?


 i dint get 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] MS written test

2011-09-07 Thread teja bala

Can anyone plzz xplain the code?

public static int swapOddEvenBits(int x) {
 return ( ((x  0x)  1) | ((x  0x)  1) );
 }

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

2011-09-05 Thread teja bala
@karthik
here u'r just making the pointer null that means pointer reference gets lost
but

  ?
 1-23

here ? means pointer that gets lost if u make it null but the 2 node is
still pointing to 3 , how would u solve dis one.
On Mon, Sep 5, 2011 at 7:13 PM, kARTHIK R k4rth...@gmail.com wrote:

 Just add the necessary checks for the end conditions.

 void delete(node *ptr) {

  node *newptr = ptr-next;
  if(newptr) {
ptr-val = newptr-val;
ptr-next = newptr-next;
delete newptr;
  }
  else ptr=NULL;

 }


 Karthik R,
 RD Engineer,
 Tejas Networks.



 On Mon, Sep 5, 2011 at 7:00 PM, $hr! k@nth srithb...@gmail.com wrote:

 @sukran: So can't I delete the last node, if pointer to that node is
 given? Can you please elaborate it..


 On Mon, Sep 5, 2011 at 6:47 PM, sukran dhawan sukrandha...@gmail.comwrote:

 it wont work.u can set a sentinel value for the last node and make it
 dummy.so every time u scan the list u need to compare

 while(list != null and list-vlue != dummy)


 On Mon, Sep 5, 2011 at 6:34 PM, $hr! k@nth srithb...@gmail.com wrote:

 How this will work if the node to be deleted is the last node??


  On Mon, Sep 5, 2011 at 5:32 PM, kARTHIK R k4rth...@gmail.com wrote:

 void delete(node *ptr) {

  node *newptr = ptr-next;
  ptr-val = newptr-val;
  ptr-next = newptr-next;
  delete newptr;

 }


 Karthik R,
 RD Engineer,
 Tejas Networks.



 On Mon, Sep 5, 2011 at 5:29 PM, $hr! k@nth srithb...@gmail.comwrote:

 Hi guyz,

 *Given only a pointer to a node to be deleted in a singly linked
 list, how do you delete it?*

 if that node is in between the list, we can copy the data from next
 node into this node and we can delete the next node.
 what if the node to be deleted is last node ??
 if the list is circular linked list, does it make any difference??

 --
 Regards,
 $hr!k@nth

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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,
 $hr!k@nth

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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,
 $hr!k@nth

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] explain the output..!!

2011-09-05 Thread teja bala
is ans?
001,010

On Mon, Sep 5, 2011 at 7:48 PM, Mohit Goel mohitgoel291...@gmail.comwrote:

 1) #include stdio.h
#include stdlib.h

#define SIZEOF(arr) (sizeof(arr)/sizeof(arr[0]))

#define PrintInt(expr) printf(%s:%d\n,#expr,(expr))
int main ()
   {
/* The powers of 10 */
int pot[] = {
 0001,0010,0100,1000

};
int i;

for(i=0;iSIZEOF(pot);i++)
PrintInt(pot[i]);
return 0;
   }

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

2011-09-05 Thread teja bala
resource records which is a 5
tuple(domain_name,type,value,class,time_to_live) is returned to respective
browser request when a resolver gets called..

On Mon, Sep 5, 2011 at 9:46 PM, rShetty rajeevr...@gmail.com wrote:

 Which is the data Structure used to store the IP addresses in a
 network ?
 Please Elaborate?

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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: Stack problem

2011-09-05 Thread teja bala
You can implement this by having each node in the stack keep track of the
minimum be­neath itself.Then, to find the min, you just look at what the top
element thinks is the min.

When you push an element onto the stack, the element is given the current
minimum.It sets its “local min” to be the min.

 public class StackWithMin extends StackNodeWithMin {

 public void push(int value) {

 int newMin = Math.min(value, min());

 super.push(new NodeWithMin(value, newMin));

 }


  public int min() {

 if (this.isEmpty()) {

 return Integer.MAX_VALUE;

 } else {

 return peek().min;

 }

 }

 }


  class NodeWithMin {

 public int value;

 public int min;

 public NodeWithMin(int v, int min){

 value = v;

 this.min = min;

 }

 }

There’s just one issue with this: if we have a large stack, we waste a lot
of space by keeping track of the min for every single element.Can we do
better?

We can (maybe) do a bit better than this by using an additional stack which
keeps track of the mins.

 public class StackWithMin2 extends StackInteger {

 StackInteger s2;

 public StackWithMin2() {

 s2 = new StackInteger();

 }

 public void push(int value){

 if (value = min()) {

 s2.push(value);

 }

 super.push(value);

 }

 public Integer pop() {

 int value = super.pop();

 if (value == min()) {

 s2.pop();

 }

 return value;

 }

 public int min() {

 if (s2.isEmpty()) {

 return Integer.MAX_VALUE;

 } else {

 return s2.peek();

 }

 }

 }

Why might this be more space efficient? If many elements have the same local
min, then we’re keeping a lot of duplicate data.By having the mins kept in a
separate stack, we don’t have this duplicate data (although we do use up a
lot of extra space because we have a stack node instead of a single int).

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: C puzzle

2011-09-04 Thread teja bala
but o/p is -15 -13 -11 -9

On Sun, Sep 4, 2011 at 3:38 AM, vikas vikas.rastogi2...@gmail.com wrote:

 f(19222)
  |
  |
 f(1922) -11 -2 =-13
  |
  |
 f(192) = -9 -2 = -11
  |
  |
 f(19) = f(1) - 9 = -9
  |
  |
  f(1) = 0

 output -9 -11 -13


 On Sep 3, 10:29 pm, teja bala pawanjalsa.t...@gmail.com wrote:
  Find the output of the following code - plzzz xplain the o/p
  int find(int j)
  {
  if(j1)
  {
  j=find(j/10)-(j%10);
  printf(%d,j);}
 
  else
  {
  j=0;}
  return j;
  }
 
  int main()
  {
  int i=19222;
  int k;
  k=find(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: C puzzle

2011-09-04 Thread teja bala
@neha could u xplain it?

On Sun, Sep 4, 2011 at 12:05 PM, Neha Gupta nehagup...@gmail.com wrote:

 o/p : -9-11-13-15

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

2011-09-03 Thread teja bala
Design the data structures for an online book reader system ?


 We can implement it by using trie data structure but is der any other data
structure that is more efficient


plzz explain it in more elaborated way .

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] arrays in c

2011-09-03 Thread teja bala
arr means the base address of the entire character array if u increase it
i.e arr++ array reference that means arr no longer referring to the
respective character array, it 'll be lost that's y C won't allow to modify
the arr's address.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] character count in array

2011-09-03 Thread teja bala
this 'll work if u i/p the string in dis manner
aaabbcc(consecutive same)
a3b2c2

#includestdio.h
#includeconio.h
main()
{
int x=1,i=0;
char a[100];
gets(a);
while(a[i]!='\0')
{
 while(a[i]==a[i+1])
 {
x++;
i++;
 }
 printf(%c%d,a[i],x);
 x=1;
 i++;
 }
getchar();
}

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

2011-09-03 Thread teja bala
SORT ARRAY ON BASIS OF OCCURENCE OF NUMBER

{3,3,2,5,5,,5}

OUTPUT SHOULD BE LIKE THIS
{5,5,5,3,3,2}

PLEASE HELP ME WITH CODING PART

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

2011-09-03 Thread teja bala
Any one plzz post the material for suffix tree or elaborate suffix
tree entirely..

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



[algogeeks] C puzzle

2011-09-03 Thread teja bala
Find the output of the following code - plzzz xplain the o/p
int find(int j)
{
if(j1)
{
j=find(j/10)-(j%10);
printf(%d,j);
}
else
{
j=0;
}
return j;
}
int main()
{
int i=19222;
int k;
k=find(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.



[algogeeks] MICROSOFT

2011-09-03 Thread teja bala
//Asked in MS please help me with the coding or Give an algorithm


Write code to return the kth largest element in a tree ... function
prototype is int fucnkth(node *root,int 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.



Re: [algogeeks] query for nit kurukshtra students

2011-08-31 Thread teja bala
#includestdio.h
void fac(int a)
{
 if(a=0)
 {
 printf(%d\n,a);
 fac(a-=5);
 }
 if(a=0)printf(%d\n,a);
}
main()
{
 fac(15);
}

On Wed, Aug 31, 2011 at 11:09 AM, Dheeraj Sharma 
dheerajsharma1...@gmail.com wrote:

 int num=15 //global variable

 void fun()
 {
 if(num=0)
 {
 printf(0\n);
 return;
 }

 printf(%d\n,num);
 num-=5;
 fun();
 num+=5;
 printf(%d\n,num);

 }

 On Wed, Aug 31, 2011 at 10:59 AM, bharatkumar bagana 
 bagana.bharatku...@gmail.com wrote:

 can u pls tell me the answer for the 2nd question..


 On Tue, Aug 30, 2011 at 12:04 PM, Dheeraj Sharma 
 dheerajsharma1...@gmail.com wrote:

 yeah it came yesterday..the paper was very easy
 1.u have to find loop in linked list..
 2.u are given a number..you have to print it down to zero(subtracting 5)
 and then print from 0 to that number(adding 5) without using local
 variables.
 3.two C questions ..that were very easy..
 4.Print the sum of the even terms occuring in Fibbonaci (till 1000 terms)

 rest i dont remember..as i didnt gave the paper..this is what my frnds
 told me..



 On Tue, Aug 30, 2011 at 9:23 PM, rahul sharma 
 rahul23111...@gmail.comwrote:

 had microsoft came in nit kurukshetra in last weekif yes then guys
 from nit kurukshetra plz tell there procedure n questions???thnx in
 advance guys

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




 --
 *Dheeraj Sharma*
 Comp Engg.
 NIT Kurukshetra
 +91 8950264227


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




 --

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




 --
 *Dheeraj Sharma*
 Comp Engg.
 NIT Kurukshetra

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

2011-08-31 Thread teja bala
Hi guys 
Anyone from CBIT , if so please post the questions of microsoft written test
that took place in last month.

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

2011-08-31 Thread teja bala
@rohit i think 0 will also be printed as the last while condition'll be
checked too

On Wed, Aug 31, 2011 at 6:59 PM, rohit raman.u...@gmail.com wrote:

 123456789

 --
 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/-/OsL6-Vp91qoJ.

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

2011-08-30 Thread teja bala
@aditya kumar
Will u plz explain the logic involved here...?

On Tue, Aug 30, 2011 at 7:40 PM, aditya kumar
aditya.kumar130...@gmail.comwrote:

 void getSquareRoot(float s)
  {
   float a=s;
   int i=0;
   for(i=0;i20;i++)
   {
   a=(s+a*a)/(2*a);
  }
 printf(square root is %f,a);
  }

 On Tue, Aug 30, 2011 at 6:00 PM, Sanjay Rajpal srn...@gmail.com wrote:

 Binary Search kind of mathod is useful here :

 float SquareRoot(float n,float start,float end)
 {
 float s=(start+end)/2;
 if(n - sqr(s)  0.001)  (n - sqr(s)  -0.001))
return (end+start)/2;
 else if(sqr(s)  n)
return SquareRoot(n,0.0,s);
 else
return SquareRoot(n,s,end);
 }

 Sanju
 :)



 On Tue, Aug 30, 2011 at 3:25 AM, UTKARSH SRIVASTAV 
 usrivastav...@gmail.com wrote:

 i don't whethe you have studied a subject cbnst from that use newton
 raphson method


 On Tue, Aug 30, 2011 at 2:39 AM, Ankuj Gupta ankuj2...@gmail.comwrote:

 U can use binary search method

 On Aug 30, 1:56 pm, Rajeev Kumar rajeevprasa...@gmail.com wrote:
  use Babylonian method(Efficient) algrithm..
  Refer :
 http://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylo.
 ..
 
  public *void* getSquareRoot(double s) {
double Xn = 2.0;
double lastXn = 0.0;
while (Xn != lastXn) {
 lastXn = Xn;
 Xn = (Xn + s / Xn) / 2.0;
}
return Xn;
   }
 
 
 
 
 
 
 
 
 
  On Tue, Aug 30, 2011 at 1:49 PM, Ankur Garg ankurga...@gmail.com
 wrote:
   @techcoder
 
   Making an array of 32768 or INT_MAX will make ur compiler cry
 
   Also ur case doesnt handle the scenario where square root is a
 decimal
   number
 
   On Tue, Aug 30, 2011 at 1:35 PM, tech coder 
 techcoderonw...@gmail.comwrote:
 
   the sqrt of 32 bit number can't be more than 16 bits.
 
   have an array of 2^16 elemnts wtih elemts 1 2 3 4 5  32768 .
 
   now apply binary search
   i=a[mid]where mid=(lower+upper)/2
 
   if(i*i==num)
   i is the sqrt
 
   increment lower and upper accordingly as we do in binary search
 
   so order is Olognwhere n=2^16
 
On Tue, Aug 30, 2011 at 11:37 AM, Raghavan its...@gmail.com
 wrote:
 
   how to design this logic effectively?
 
   double squareRoot(int num){
 
   }
 
   --
   Thanks and Regards,
   Raghavan KL
 
--
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from 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.
 
  --
  Thank You
  Rajeev Kumar

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




 --
 *UTKARSH SRIVASTAV
 CSE-3
 B-Tech 3rd Year
 @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.


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

Re: [algogeeks] C puzzle

2011-08-29 Thread teja bala


 @Anup


   Can u pls explain the program ?

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

2011-08-28 Thread teja bala
import  java.io.*;
class hi
{
public static void main(String args[])throws IOException
{
FileReader fr=new FileReader(hi.java);
int c;
while((c=fr.read())!= -1)
{
System.out.print((char)c);
}
}
}

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

2011-08-27 Thread teja bala
if any one aware of microsoft written test please give me the suggestions
and respective links
thx.

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

2011-08-27 Thread teja bala
Hi Guys
 If u are aware of microsoft written test please give me suggestions
and send the respective links
 that i can work on...

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

2011-08-23 Thread teja bala
int a,b,c;
c=(ab)?a:b;
print(c);

On Tue, Aug 23, 2011 at 6:37 PM, Abhishek Yadav
algowithabhis...@gmail.comwrote:

 Write a method which finds the maximum of two numbers  You should not
 use if-else
 or any other comparison operator.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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: calculate a/b without using ‘*’, ‘/’’ and ‘%’

2011-08-23 Thread teja bala
//works only for ints
#includestdio.h
 int div(int a,int b);
 main()
 {
  int q,w,x;
  scanf(%d %d,q,w);
  x=div(q,w);
  printf(%d,x);
 }
 int div(int x,int y)
 {
int z=x,count=0;
while(z=y)
{
 z-=y;
count++;
}
return count;
 }

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