[algogeeks] akamai.....

2011-08-11 Thread naveen ms
hey can any1 help me out...how ll be the akamai recruiment
procedure...and if u have any akamai papers please upload it


with regards

naveen

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

2011-08-11 Thread deepikaanand
@UTKARSH i know the selection criteria but i want to know exactly the
qs asked...plzz post a few qs if u knw any...

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

2011-08-11 Thread krishna meena
i think raid level 3 provide high transfer rate with single stream I/O
applications such as graphical imaging processors , CAD/CAM files etc.


On Wed, Aug 10, 2011 at 6:11 AM, Gary Drocella gdroc...@gmail.com wrote:

 RAID Level 0 is used for high performance where data loss isn't
 critical.  Bit stripping is still performed
 over multiple disks, but no mirroring or parity bits used for checking
 data integrity.

 On Aug 9, 2:56 pm, Vivek Srivastava srivastava.vivek1...@gmail.com
 wrote:
  On Wed, Aug 10, 2011 at 12:22 AM, raghavendhra rahul 
 
 
 
 
 
 
 
  rahulraghavend...@gmail.com wrote:
   @krishnameena: i think its 5
 
   correct me if i m wrong
 
   --
 
   Regards
   Raghavendhra
 
   It's Raid level 3
   changing the face can change nothing .. but facing the change can
   change everything
 
--
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.

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



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



Re: [algogeeks] Re: Problems on Linked List

2011-08-11 Thread mohit verma
hey guys , can't it be like this without reversing list-

int rec_iterate(Node head1,Node *head2)
{
if(head1 ==NULL ) return 1;
   if(rec_iterate(head1-n,head2) == 0) return 0;
if (head1-value == (*head2)-value)
 { *head2=(*head2)-next;
return 1;
  }
  else return 0;
}

provided lists are of same length.

On Thu, Aug 11, 2011 at 1:30 AM, Don dondod...@gmail.com wrote:

 Q1: The function below reverses a linked list in place. Call it on one
 of the lists, compare the resulting list to the other list. Then call
 it again to put the list back in its original order.

 list Reverse(list head)
 {
  list T, prv, nxt;

  prv = head;
  for(T = head-next; T; T = nxt)
  {
nxt = T-next;
T-next = prv;
prv = T;
T = nxt;
  }
  head-next = 0;
  return prv;
 }

 Q2:
 delete(node *d)
 {
  if (d-next)
  {
node nxt = d-next;
d-value = nxt-value;
d-next = nxt-next;
free nxt;
  }
  else
  {
for(node p = head; p; p = p-next)
  if (p-next == d)
  {
p-next = 0;
free d;
   }
  }
 }

 On Aug 10, 1:14 pm, Piyush Kapoor pkjee2...@gmail.com wrote:
  Q1)Two linked Lists are given,i.e,their head pointers are given,and the
  problem is to check if the second one is reverse of the first one.Give
 the
  most efficient algo for it.
  Q2)A linked list is given,and one of its nodes is given.The problem is to
  delete the given node from the linked list.(The head node is not given).
  (In both of the above cases,the linked lists are singly linked lists.)
  --
  *Regards,*
  *Piyush Kapoor,*
  *2nd year,CSE
  IT-BHU*

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




-- 

*MOHIT VERMA*

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Plz tell wat questions are asked by MICROSOFT IDC and IT both...Plz Reply fast.....anyone...!!

2011-08-11 Thread anshu kandhari
How you got the call buddy


On Aug 10, 11:43 pm, vishwan baghla vishwanbag...@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.



[algogeeks] Doubt Related To Java

2011-08-11 Thread rahul rai
public class JoyOfHex {

public static void main(String[] args) {

System.out.println(

Long.toHexString(0x1L + 0xcafebabe));

}

}


I got the problem from Java Puzzlers Book

Here Is Their Explanation ::

Decimal literals have a nice property that is not shared by
hexadecimal or octal literals: Decimal literals are all positive [JLS
3.10.1]. To write a negative decimal constant, you use the unary
negation operator (-) in combination with a decimal literal. In this
way, you can write any int or long value, whether positive or
negative, in decimal form, and negative decimal constants are clearly
identifiable by the presence of a minus sign. Not so for hexadecimal
and octal literals. They can take on both positive and negative
values. Hex and octal literals are negative if their high-order bit is
set. In this program, the number 0xcafebabe is an int constant with
its high-order bit set, so it is negative. It is equivalent to the
decimal value -889275714.

The addition performed by the program is a mixed-type computation: The
left operand is of type long, and the right operand is of type int. To
perform the computation, Java promotes the int value to a long with a
widening primitive conversion [JLS 5.1.2] and adds the two long
values. Because int is a signed integral type, the conversion performs
sign extension: It promotes the negative int value to a numerically
equal long value.

The right operand of the addition, 0xcafebabe, is promoted to the long
value 0xcafebabeL. This value is then added to the left
operand, which is 0x1L. When viewed as an int, the high-order
32 bits of the sign-extended right operand are -1, and the high-order
32 bits of the left operand are 1. Add these two values together and
you get 0, which explains the absence of the leading 1 digit in the
program's output. Here is how the addition looks when done in
longhand. (The digits at the top of the addition are carries.)


111

  0xcafebabeL

+ 0x0001L

  0xcafebabeL






What I Do Not Understand Is That How Exactly Does  One Can See (Or
Guess)  A Hex Word --cafebabe-- and deduce that it's most significant
bit is one ergo it is going to represented as -ve :

Apologies  if I am missing something too naive

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

2011-08-11 Thread rajeev bharshetty
Round Robin ..

On Thu, Aug 11, 2011 at 11:01 AM, siddharam suresh
siddharam@gmail.comwrote:

 shortest preemptive  job first
 Thank you,
 Siddharam



 On Thu, Aug 11, 2011 at 10:49 AM, krishna meena 
 krishna.meena...@gmail.com wrote:

 Consider a set of n teaks with known runtimes  r1,r2,r3rn to be
 run on a uni-processor machine. which processor scheduling algorithm
 will result in the maximum throughput?

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
Rajeev N B http://www.opensourcemania.co.cc

*Winners Don't do Different things , they do things Differently*

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

2011-08-11 Thread Algo Lover
Given an array, start from the first element and reach the last by
jumping. The jump length can be at most the value at the current
position in the array. Optimum result is when you reach the goal in
minimum number of jumps.

For ex:
Given array A = {2,3,1,1,4}
possible ways to reach the end (index list)
i) 0,2,3,4 (jump 2 to index 2, then jump 1 to index 3 then 1 to index
4)
ii) 0,1,4 (jump 1 to index 1, then jump 3 to index 4)

Since second solution has only 2 jumps it is the optimum result.

My solution is for any index i loop from i to i + A[i]
   find an index j where
(j + A[j]) is maximum for all j.
   make i=j;

This solution in O(n) i suppose coz we are picking each element twice
in the worst case.

I have read a O(n^2) DP solution for this problem.Is there any
case where my approach will fail ?




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

2011-08-11 Thread Arun Vishwanathan
hmm ya am sorry abt that..what abt the first part i mentioned...how is it
(nodeptr*)malloc according to you (which is creating a pointer to a pointer
type nodeptr )rather than just nodeptr which is a pointer to structure?
how to get size of structure as such in this case?

On Thu, Aug 11, 2011 at 7:04 AM, siddharth srivastava
akssps...@gmail.comwrote:



  (sizeof(struct)); ??


 That doesn't makes sense. Size of struct is what ?? you need the size of
 your structure with the variables you have declared in it.



 cos malloc returns pointer to memory block and nodeptr itself is a pointer
 and you have used nodeptr* further?



 On Tue, Aug 9, 2011 at 6:32 PM, siddharth srivastava akssps...@gmail.com
  wrote:

  @sidharth: thanks a lot for correcting me :)
 @aditya : no. there was some mistake;

 in the code i pasted above it's giving segmentation fault. Is it cause
 i'm initializing h without using malloc??
 Please throw light on this problem


 Pointer points to a location in memory. You can't use h without making h
 to reference to some area in memory.



 And in the following code
 char *s;
 scanf(%s, s);
 why isn't it possible to store a string in s??

 Please explain both concepts.

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



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




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

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




 --
 Regards
 Siddharth Srivastava


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




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

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



[algogeeks]

2011-08-11 Thread sukran dhawan
can anyone tell me wat exactly they look at HR round? is it true if we have
cleared technical rounds we are almost thru to get a job?

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

2011-08-11 Thread Arun Vishwanathan
I did not get the optimal solution part..how is that u jump 1 to index 1?

On Thu, Aug 11, 2011 at 10:07 AM, Algo Lover algolear...@gmail.com wrote:

 Given an array, start from the first element and reach the last by
 jumping. The jump length can be at most the value at the current
 position in the array. Optimum result is when you reach the goal in
 minimum number of jumps.

 For ex:
 Given array A = {2,3,1,1,4}
 possible ways to reach the end (index list)
 i) 0,2,3,4 (jump 2 to index 2, then jump 1 to index 3 then 1 to index
 4)
 ii) 0,1,4 (jump 1 to index 1, then jump 3 to index 4)

 Since second solution has only 2 jumps it is the optimum result.

 My solution is for any index i loop from i to i + A[i]
   find an index j where
 (j + A[j]) is maximum for all j.
   make i=j;

 This solution in O(n) i suppose coz we are picking each element twice
 in the worst case.

 I have read a O(n^2) DP solution for this problem.Is there any
 case where my approach will fail ?




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




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

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



[algogeeks] Re: Doubt Related To Java

2011-08-11 Thread Rahul
Can Any one tell me when the least significant bits are chopped off ,
and when the most significant bits are chopped off ..I am confused :


 System.out.println((int) (char) (byte) -1);
lower bits chopped ?


int i = 123456;

x += i; // Contains a hidden cast!

System.out.println(x);
Higher bits chopped?
-


On 8/11/11, rahul rai raikra...@gmail.com wrote:
 public class JoyOfHex {

 public static void main(String[] args) {

 System.out.println(

 Long.toHexString(0x1L + 0xcafebabe));

 }

 }


 I got the problem from Java Puzzlers Book

 Here Is Their Explanation ::
 
 Decimal literals have a nice property that is not shared by
 hexadecimal or octal literals: Decimal literals are all positive [JLS
 3.10.1]. To write a negative decimal constant, you use the unary
 negation operator (-) in combination with a decimal literal. In this
 way, you can write any int or long value, whether positive or
 negative, in decimal form, and negative decimal constants are clearly
 identifiable by the presence of a minus sign. Not so for hexadecimal
 and octal literals. They can take on both positive and negative
 values. Hex and octal literals are negative if their high-order bit is
 set. In this program, the number 0xcafebabe is an int constant with
 its high-order bit set, so it is negative. It is equivalent to the
 decimal value -889275714.

 The addition performed by the program is a mixed-type computation: The
 left operand is of type long, and the right operand is of type int. To
 perform the computation, Java promotes the int value to a long with a
 widening primitive conversion [JLS 5.1.2] and adds the two long
 values. Because int is a signed integral type, the conversion performs
 sign extension: It promotes the negative int value to a numerically
 equal long value.

 The right operand of the addition, 0xcafebabe, is promoted to the long
 value 0xcafebabeL. This value is then added to the left
 operand, which is 0x1L. When viewed as an int, the high-order
 32 bits of the sign-extended right operand are -1, and the high-order
 32 bits of the left operand are 1. Add these two values together and
 you get 0, which explains the absence of the leading 1 digit in the
 program's output. Here is how the addition looks when done in
 longhand. (The digits at the top of the addition are carries.)


 111

   0xcafebabeL

 + 0x0001L

   0xcafebabeL


 



 What I Do Not Understand Is That How Exactly Does  One Can See (Or
 Guess)  A Hex Word --cafebabe-- and deduce that it's most significant
 bit is one ergo it is going to represented as -ve :

 Apologies  if I am missing something too naive



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



[algogeeks] -1 representation

2011-08-11 Thread Raman
How is -1 represented in signed and unsigned int form??

Is it right, -1 as all ones in unsigned form
and 1000...1  in signed form

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

2011-08-11 Thread Navneet Gupta
Q. Design a concurrent hash table with as much as concurrency as possible.
System has multiple readers and writers. System will crash if a reader or
writer is reading or writing from a location which is being updated by some
writer. We need to prevent crash.

It is pretty much an open-ended question, so basically looking for
strategies.

-- 
Regards,
Navneet

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

2011-08-11 Thread mohit verma
open addressing with  fairness : going up on even collision and going down
on odd collision.

On Thu, Aug 11, 2011 at 3:45 PM, Navneet Gupta navneetn...@gmail.comwrote:

 Q. Design a concurrent hash table with as much as concurrency as possible.
 System has multiple readers and writers. System will crash if a reader or
 writer is reading or writing from a location which is being updated by some
 writer. We need to prevent crash.

 It is pretty much an open-ended question, so basically looking for
 strategies.

 --
 Regards,
 Navneet


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




-- 

*MOHIT VERMA*

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

2011-08-11 Thread Anuj kumar
void main()
{
   int a=10,b=20;
   char x=1,y=0;
   if(a,b,x,y)
   {
  printf(EXAM);
   }
}


o/p  XAM

how it is coming plz help 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.



Re: [algogeeks] how o/p is coming

2011-08-11 Thread hary rathor
print nothing , your output is 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.



Re: [algogeeks] -1 representation

2011-08-11 Thread Rahul
hello, why don't you experiment with a calculator included in windows
or any operating system , try learning the representations of minus
two and minus three in binary . you why will soon realise the two
complement funds

On 8/11/11, Raman raman.u...@gmail.com wrote:
 How is -1 represented in signed and unsigned int form??

 Is it right, -1 as all ones in unsigned form
 and 1000...1  in signed form

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




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



Re: [algogeeks] how o/p is coming

2011-08-11 Thread Prem Krishna Chettri
Yep,

  Ideally, if() statement evaluates the last push stack value from the stack
and apparently here the last value evaluates to be 0 resulting the failure
of the if condition.

Please verify the compilation. :)

Prem

On Thu, Aug 11, 2011 at 4:21 PM, hary rathor harry.rat...@gmail.com wrote:

 print nothing , your output is 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.


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

2011-08-11 Thread sukran dhawan
how to determine whether the machine is a 32 bit or 64 bit using a c
program?
is it by sizeof(int) * 4?

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

2011-08-11 Thread Raman
Why couldn't you just write down the answer instead of giving this long 
explanation?

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

2011-08-11 Thread Shashank Jain
no ppl miss out on hr rounds too!
its d compiler which determines variable size!

Shashank Jain
IIIrd year
Computer Engineering
Delhi College of Engineering



On Thu, Aug 11, 2011 at 4:35 PM, sukran dhawan sukrandha...@gmail.comwrote:

 how to determine whether the machine is a 32 bit or 64 bit using a c
 program?
 is it by sizeof(int) * 4?

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

2011-08-11 Thread Aditya Virmani
u can never find tht thru ur prgm...sizeof int is compiler dependant whether
its 32/64 bit...

On Thu, Aug 11, 2011 at 4:35 PM, sukran dhawan sukrandha...@gmail.comwrote:

 how to determine whether the machine is a 32 bit or 64 bit using a c
 program?
 is it by sizeof(int) * 4?

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

2011-08-11 Thread sukran dhawan
thanks

On Thu, Aug 11, 2011 at 5:02 PM, Aditya Virmani virmanisadi...@gmail.comwrote:

 u can never find tht thru ur prgm...sizeof int is compiler dependant
 whether its 32/64 bit...

 On Thu, Aug 11, 2011 at 4:35 PM, sukran dhawan sukrandha...@gmail.comwrote:

 how to determine whether the machine is a 32 bit or 64 bit using a c
 program?
 is it by sizeof(int) * 4?

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

2011-08-11 Thread sindhu
1. write a method to find the smallest angle between two hands when
the time is given as input???
2. given a number between 1 to 1000 convert it to words..example
235..it should print as two hundred thirty five..
3. write test cases for elevator in a multistory building..
4. a chessboard of size 64 blocks is given..a knight can move two n
half moves at a time..how many steps will it take to cover all the 64
blocks...and change the algorithm if the knight moves three and a half
moves.
5. what will be the result if you execute the following code segment:
1+2+4

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

2011-08-11 Thread Gayathri Anandan
Given two strings say AB and CD you should print all the possible
combinations. Use any language.

output: ABCD, ABDC, ACDB, ADBD, ADBC, ADCB 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] find a solution

2011-08-11 Thread surender sanke
concatenate both and find all permutations of that string

surender

On Thu, Aug 11, 2011 at 5:34 PM, Gayathri Anandan 
gayathriananda...@gmail.com wrote:

 Given two strings say AB and CD you should print all the possible
 combinations. Use any language.

 output: ABCD, ABDC, ACDB, ADBD, ADBC, ADCB 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.



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

2011-08-11 Thread aditya kumar
 printf(%d,((int)((int *)0  +  1))*8);
 o/p :: 32/64

On Thu, Aug 11, 2011 at 5:14 PM, sukran dhawan sukrandha...@gmail.comwrote:

 thanks


 On Thu, Aug 11, 2011 at 5:02 PM, Aditya Virmani 
 virmanisadi...@gmail.comwrote:

 u can never find tht thru ur prgm...sizeof int is compiler dependant
 whether its 32/64 bit...

 On Thu, Aug 11, 2011 at 4:35 PM, sukran dhawan sukrandha...@gmail.comwrote:

 how to determine whether the machine is a 32 bit or 64 bit using a c
 program?
 is it by sizeof(int) * 4?

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

2011-08-11 Thread Algo Lover
Suppose i create a block of 10 ints, p is a pointer pointing to this
block.

int (*p)[10];

How can i initialize these 10 integer blocks using pointer p.

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

2011-08-11 Thread rohit jangid
@aditya . (int*)0 is pointing to Null value , so (int*)0+1 will be 0x4
which is the size of int as implemented in compiler . so basically
your code is returning sizeof(int) which will always return 4 which is
equivalent to 32 bits .
I couldn't check this program on a 64 bit machine ( p.s. mine support
64 bit but the OS is 32 bit )
but I guess it will return 32 on 64 bit machine as well
I may be wrong, so If you have run this code and found 64 than let me know.

On Thu, Aug 11, 2011 at 5:59 PM, aditya kumar
aditya.kumar130...@gmail.com wrote:
  printf(%d,((int)((int *)0  +  1))*8);
  o/p :: 32/64
 On Thu, Aug 11, 2011 at 5:14 PM, sukran dhawan sukrandha...@gmail.com
 wrote:

 thanks

 On Thu, Aug 11, 2011 at 5:02 PM, Aditya Virmani virmanisadi...@gmail.com
 wrote:

 u can never find tht thru ur prgm...sizeof int is compiler dependant
 whether its 32/64 bit...

 On Thu, Aug 11, 2011 at 4:35 PM, sukran dhawan sukrandha...@gmail.com
 wrote:

 how to determine whether the machine is a 32 bit or 64 bit using a c
 program?
 is it by sizeof(int) * 4?

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




-- 
Rohit Jangid
Under Graduate Student,
Deptt. of Computer Engineering
NSIT, Delhi University, India

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

2011-08-11 Thread rShetty
A hash table can store a maximum of 10 records, currently there are
records in location 1, 3,4,7,8,9,10. The probability of a new record
going into location 2, with hash functions resolving collisions by
linear probing is
a. 0.1b. 0.6  c. 0.2  d. 0.5

I think the answer is 0.6
What do you think?
Correct me If I am 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.



Re: [algogeeks] find a solution

2011-08-11 Thread Gaurav Menghani
I guess we should learn to google first.

On Thu, Aug 11, 2011 at 5:58 PM, surender sanke surend...@gmail.com wrote:
 concatenate both and find all permutations of that string

 surender

 On Thu, Aug 11, 2011 at 5:34 PM, Gayathri Anandan
 gayathriananda...@gmail.com wrote:

 Given two strings say AB and CD you should print all the possible
 combinations. Use any language.

 output: ABCD, ABDC, ACDB, ADBD, ADBC, ADCB 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.


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




-- 
Gaurav Menghani

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

2011-08-11 Thread Gaurav Menghani
In C++ it is done in the following way:
- Concatenate all strings
- Sort the string
- Use next_permuation


On Thu, Aug 11, 2011 at 7:01 PM, Gaurav Menghani
gaurav.mengh...@gmail.com wrote:
 I guess we should learn to google first.

 On Thu, Aug 11, 2011 at 5:58 PM, surender sanke surend...@gmail.com wrote:
 concatenate both and find all permutations of that string

 surender

 On Thu, Aug 11, 2011 at 5:34 PM, Gayathri Anandan
 gayathriananda...@gmail.com wrote:

 Given two strings say AB and CD you should print all the possible
 combinations. Use any language.

 output: ABCD, ABDC, ACDB, ADBD, ADBC, ADCB 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.


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




 --
 Gaurav Menghani




-- 
Gaurav Menghani

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

2011-08-11 Thread UTKARSH SRIVASTAV
#includestdio.h
main()
{
  int a[10],i;
  int (*p)[10];
  p=a;
  for( i=0;i10;i++)
  {
   *((int *)p+i)=i;
  }
  for( i=0;i10;i++)
  {
   printf( %d,a[i]);
  }

}

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



Re: [algogeeks] Re: Sort IT

2011-08-11 Thread surender sanke
@dave, ur converting array values into baseN and doing radix?
then every time there will be N*N = 100(baseN).
i think ur code doesn't works as ur checking against msd first(/) , then
lsd(%)
we need to exchange these operations, then it works fine.

surender
On Wed, Aug 3, 2011 at 3:55 PM, Dave dave_and_da...@juno.com wrote:

 @Arun: Look up Radix sort and then read the comments in the code.

 Dave


 On Aug 3, 4:23 am, Arun Vishwanathan aaron.nar...@gmail.com wrote:
  yes dave it wud be better if u cud post an explanation of what u r doing
 in
  each step..thanks
 
 
 
  On Wed, Aug 3, 2011 at 6:51 AM, payel roy smithpa...@gmail.com wrote:
   @Dave,
   Can you please explain the algo? It's getting very difficult to
 understand
   the code ..
 
   On 3 August 2011 01:14, Dave dave_and_da...@juno.com wrote:
 
   @Pankaj: Assuming generously that by N^2 you mean N*N instead of N
   exclusive-or 2, your very first statement is already O(N^2), as it
   will take that long just to set the array to zero.
 
   Here is a radix sort to sort an array x[N] containing values from 1 to
   N*N in O(N):
 
   int a[N], b[N], i;
   // initialize and tally occurrences of first radix-N digit of x[i]-1:
   for( i = 0 ; i  N ; ++i )
  a[i] = 0;
   for( i = 0 ; i  N ; ++i )
  a[(x[i]-1)/N]++;
   // compute starting point for each radix digit:
   a[N-1] = N - a[N-1];
   for( i = N-2 ; N = 0 ; --i )
  a[i] = a[i+1] - a[i];
   // move numbers from array x to temp array b:
   for( i = 0 ; i  N ; ++i )
  b[a[(x[i]-1)/N]++] = x[i];
 
   // initialize and tally occurrences of second radix-N digit of x[i]-1:
   for( i = 0 ; i  N ; ++i )
  a[i] = 0;
   for( i = 0 ; i  N ; ++i )
  a[(x[i]-1)%N]++;
   // compute starting point for each radix digit:
   a[N-1] = N - a[N-1];
   for( i = N-2 ; N = 0 ; --i )
  a[i] = a[i+1] - a[i];
   // move numbers from temp array b back to array x:
   for( i = 0 ; i  N ; ++i )
  x[a[(x[i]-1)%N]++] = b[i];
   // array is now sorted. Run time is O(N). Space is O(N).
 
   Dave
 
   On Aug 2, 11:04 am, pankaj kumar pancsen...@gmail.com wrote:
int a[N^2]={0},i,j;
for(i=0;iN^2;i++)
{
cinj;
a[j]++;
 
}
 
for(i=0;iN^2;i++)
{
if(a[i]!=0)
{
while(a[i]--)
{
couti\t;
 
}
}- 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.- 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] Re: goldman sachs paper

2011-08-11 Thread deepikaanand
 plzz post the paper  ! !

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

2011-08-11 Thread Samba Ganapavarapu
Can we find any alg. which runs faster than O(n^2) using these 2 axioms ?

2011/8/10 Amethy hobby news...@gmail.com

 it also like Pythagorean theorem;
 so the a[k] also with the value where
 a[j]-a[i]a[k]a[i]+a[j]
 and a[k]a[j]=a[i];

 On 8月9日, 下午10时43分, Samba Ganapavarapu sambasiv...@gmail.com wrote:
  We have an array of integers, we need to find the element a[i],a[j] and
 a[k]
  values where.. a[i]^2 + a[k]^2 = a[k] ^2
  what would be the fast algorithm to find ?
 
  - Samba

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

2011-08-11 Thread Dave
@Surender: Yes. Actually, I'm converting a[i]-1 into radix N. The most
significant digit is (a[i]-1)/N, and the least significant digit is
(a[i]-1)%N. You are right that the lsd should be before the msd.
Thanks.

Dave

On Aug 11, 8:44 am, surender sanke surend...@gmail.com wrote:
 @dave, ur converting array values into baseN and doing radix?
 then every time there will be N*N = 100(baseN).
 i think ur code doesn't works as ur checking against msd first(/) , then
 lsd(%)
 we need to exchange these operations, then it works fine.

 surender



 On Wed, Aug 3, 2011 at 3:55 PM, Dave dave_and_da...@juno.com wrote:
  @Arun: Look up Radix sort and then read the comments in the code.

  Dave

  On Aug 3, 4:23 am, Arun Vishwanathan aaron.nar...@gmail.com wrote:
   yes dave it wud be better if u cud post an explanation of what u r doing
  in
   each step..thanks

   On Wed, Aug 3, 2011 at 6:51 AM, payel roy smithpa...@gmail.com wrote:
@Dave,
Can you please explain the algo? It's getting very difficult to
  understand
the code ..

On 3 August 2011 01:14, Dave dave_and_da...@juno.com wrote:

@Pankaj: Assuming generously that by N^2 you mean N*N instead of N
exclusive-or 2, your very first statement is already O(N^2), as it
will take that long just to set the array to zero.

Here is a radix sort to sort an array x[N] containing values from 1 to
N*N in O(N):

int a[N], b[N], i;
// initialize and tally occurrences of first radix-N digit of x[i]-1:
for( i = 0 ; i  N ; ++i )
   a[i] = 0;
for( i = 0 ; i  N ; ++i )
   a[(x[i]-1)/N]++;
// compute starting point for each radix digit:
a[N-1] = N - a[N-1];
for( i = N-2 ; N = 0 ; --i )
   a[i] = a[i+1] - a[i];
// move numbers from array x to temp array b:
for( i = 0 ; i  N ; ++i )
   b[a[(x[i]-1)/N]++] = x[i];

// initialize and tally occurrences of second radix-N digit of x[i]-1:
for( i = 0 ; i  N ; ++i )
   a[i] = 0;
for( i = 0 ; i  N ; ++i )
   a[(x[i]-1)%N]++;
// compute starting point for each radix digit:
a[N-1] = N - a[N-1];
for( i = N-2 ; N = 0 ; --i )
   a[i] = a[i+1] - a[i];
// move numbers from temp array b back to array x:
for( i = 0 ; i  N ; ++i )
   x[a[(x[i]-1)%N]++] = b[i];
// array is now sorted. Run time is O(N). Space is O(N).

Dave

On Aug 2, 11:04 am, pankaj kumar pancsen...@gmail.com wrote:
 int a[N^2]={0},i,j;
 for(i=0;iN^2;i++)
 {
 cinj;
 a[j]++;

 }

 for(i=0;iN^2;i++)
 {
 if(a[i]!=0)
 {
 while(a[i]--)
 {
 couti\t;

 }
 }- 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.-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] Re: -1 representation

2011-08-11 Thread Dave
@Raman. Signed integers are represented in twos-complement form. -1 is
all 1-bits.

Unsigned integers are all positive, so you can't represent -1 as an
unsigned integer.

Dave

On Aug 11, 5:13 am, Raman raman.u...@gmail.com wrote:
 How is -1 represented in signed and unsigned int form??

 Is it right, -1 as all ones in unsigned form
 and 1000...1  in signed form

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

2011-08-11 Thread Dave
@Raman. Why do you complain to someone who is trying to help you?

Dave

On Aug 11, 6:11 am, Raman raman.u...@gmail.com wrote:
 Why couldn't you just write down the answer instead of giving this long
 explanation?

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

2011-08-11 Thread Nitin Nizhawan
i guess answer is c. 4

n*i+1

On Thu, Aug 11, 2011 at 8:01 PM, rShetty rajeevr...@gmail.com wrote:

  A complete n- array tree in which each node has n children or no
 children, let i be the number of internal nodes and L be the number of
 leaves in a complete n- array tree. If L=41 and i=10 what is the value
 of n.

 a. 3b. 6   c. 4


 How to solve such problems??

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

2011-08-11 Thread Don
Sounds like you need some sort of semaphore system to lock cells in
the hash table. Essentially it would only give one user access to a
particular cell at any given time. Make sure that the cells have a
restricted interface so that they can only be accessed through the
semaphore-controlled interface. The write interface would attempt to
get the semaphore, and if successful, write the data and then release
the semaphore. If it failed, it would return a failure notice to the
caller. The read interface would check the semaphore and if it was
open, get the data.
Don

On Aug 11, 5:15 am, Navneet Gupta navneetn...@gmail.com wrote:
 Q. Design a concurrent hash table with as much as concurrency as possible.
 System has multiple readers and writers. System will crash if a reader or
 writer is reading or writing from a location which is being updated by some
 writer. We need to prevent crash.

 It is pretty much an open-ended question, so basically looking for
 strategies.

 --
 Regards,
 Navneet

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

2011-08-11 Thread rajeev bharshetty
@all : Could anyone explain it using the tree diagram . @nithin : 4 may not
be th answer i am not able to plot into a tree satisfying those constarints

On Thu, Aug 11, 2011 at 9:16 PM, Nitin Nizhawan nitin.nizha...@gmail.comwrote:

 i guess answer is c. 4

 n*i+1


 On Thu, Aug 11, 2011 at 8:01 PM, rShetty rajeevr...@gmail.com wrote:

  A complete n- array tree in which each node has n children or no
 children, let i be the number of internal nodes and L be the number of
 leaves in a complete n- array tree. If L=41 and i=10 what is the value
 of n.

 a. 3b. 6   c. 4


 How to solve such problems??

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
Rajeev N B http://www.opensourcemania.co.cc

*Winners Don't do Different things , they do things Differently*

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

2011-08-11 Thread Mani Bharathi


*A hash table can store a maximum of 10 records, currently there are records 
in location 1, 3,4,7,8,9,10. The probability of a new record going into 
location 2, with hash functions resolving collisions by linear probing is*

a.0.1 b. 0.6 c. 0.2 d. 0.5

What is the answer? How?

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

2011-08-11 Thread amit karmakar
5 is possible.
Considering root of the tree to be at level 0,
level 1 and level 2 are completely filled.

There are 5 internal nodes in level 1, (since all level 2 nodes are
present)
Now only (10 - 5(from level 1)+1(the root)) nodes are required.
So choose 4 nodes from level 2 and make them interior node.
So you get 4*5(4 nodes have 5 children) + (5*5(There are 5*5 nodes in
level 2)-4(These became leaves)) leaves.

Unfortunately 5 is not in the option

On Aug 11, 7:31 pm, rShetty rajeevr...@gmail.com wrote:
  A complete n- array tree in which each node has n children or no
 children, let i be the number of internal nodes and L be the number of
 leaves in a complete n- array tree. If L=41 and i=10 what is the value
 of n.

 a. 3    b. 6   c. 4

 How to solve such problems??

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

2011-08-11 Thread bagaria.ka...@gmail.com
0.6 is the answer i blv


On 8/11/11, Mani Bharathi manibharat...@gmail.com wrote:


 *A hash table can store a maximum of 10 records, currently there are records
 in location 1, 3,4,7,8,9,10. The probability of a new record going into
 location 2, with hash functions resolving collisions by linear probing is*

 a.0.1 b. 0.6 c. 0.2 d. 0.5

 What is the answer? How?

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

*Karan Bagaria*
*MCA Final Year*
Training and Placement Representative
*NIT Durgapur*

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

2011-08-11 Thread Algo Lover
Hi, probably you did'nt got my approach :

A={2,2,3,4,1,1,1,1,1}

first i=0 A[i] = 2

so candidates are A[1] ,A[2]

we choose max(A[1] +1 , 2 + A[2]) = A[2]

now we jump to A[2].

now candidates are A[3],A[4],A[5]
we choose max(A[3] + 3 , A[4] + 4, A[5] + 5)
= A[3]

so now we jump to A[3]

now candidates are A[4],A[5],A[6],A[7],

Clearly A[7] + 7 is maximum so we jump to A[7] and then we jump to
A[8]

so we went from 0-2-3-7-8.

Note i am not choosing max A[i] I am choosing max(i + A[i]).

Can anyone find a flaw in this approach ?


On Aug 11, 9:42 pm, Tharun Damera tharun1...@gmail.com wrote:
 Yes, greedy algo doesn't work.. U shud hv DP.. plz post the soln which u
 read..
 A={2,2,3,4,1,1,1,1,1}

 Ur algo gives 0,2,5,6,7,8(these are indices... index starts frm 0)
 best soln is 0,1,3,7,8..

 On Thu, Aug 11, 2011 at 2:37 PM, Arun Vishwanathan
 aaron.nar...@gmail.comwrote:









  I did not get the optimal solution part..how is that u jump 1 to index 1?

  On Thu, Aug 11, 2011 at 10:07 AM, Algo Lover algolear...@gmail.comwrote:

  Given an array, start from the first element and reach the last by
  jumping. The jump length can be at most the value at the current
  position in the array. Optimum result is when you reach the goal in
  minimum number of jumps.

  For ex:
  Given array A = {2,3,1,1,4}
  possible ways to reach the end (index list)
  i) 0,2,3,4 (jump 2 to index 2, then jump 1 to index 3 then 1 to index
  4)
  ii) 0,1,4 (jump 1 to index 1, then jump 3 to index 4)

  Since second solution has only 2 jumps it is the optimum result.

  My solution is for any index i loop from i to i + A[i]
                                                find an index j where
  (j + A[j]) is maximum for all j.
                                                make i=j;

  This solution in O(n) i suppose coz we are picking each element twice
  in the worst case.

  I have read a O(n^2) DP solution for this problem.Is there any
  case where my approach will fail ?

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

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

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

 --
 D.Tharun| Computer Science and Engineering, IIT Bombay | tharu...@iitb.ac.in |
 +918097345806

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

2011-08-11 Thread Mani Bharathi
how?

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

2011-08-11 Thread amit karmakar
I tried solving this problem and came to conclusion that none of the
options can be correct. Indeed for value 5, you can have a solution.
Then i googled for this question, and found out that, you have an
option missing. i.e 5 :|

On Aug 11, 9:01 pm, rajeev bharshetty rajeevr...@gmail.com wrote:
 @all : Could anyone explain it using the tree diagram . @nithin : 4 may not
 be th answer i am not able to plot into a tree satisfying those constarints

 On Thu, Aug 11, 2011 at 9:16 PM, Nitin Nizhawan 
 nitin.nizha...@gmail.comwrote:





  i guess answer is c. 4

  n*i+1

  On Thu, Aug 11, 2011 at 8:01 PM, rShetty rajeevr...@gmail.com wrote:

   A complete n- array tree in which each node has n children or no
  children, let i be the number of internal nodes and L be the number of
  leaves in a complete n- array tree. If L=41 and i=10 what is the value
  of n.

  a. 3    b. 6   c. 4

  How to solve such problems??

  --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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
 Rajeev N B http://www.opensourcemania.co.cc

 *Winners Don't do Different things , they do things Differently*

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

2011-08-11 Thread Mani Bharathi
Which data structure is useful in transferring a given graph by breadth 
first  search.


a. heapb. linkedlist   c. array   d. stack   e. queue

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

2011-08-11 Thread rajeev bharshetty
@amit: Thanks

On Thu, Aug 11, 2011 at 10:04 PM, amit karmakar
amit.codenam...@gmail.comwrote:

 I tried solving this problem and came to conclusion that none of the
 options can be correct. Indeed for value 5, you can have a solution.
 Then i googled for this question, and found out that, you have an
 option missing. i.e 5 :|

 On Aug 11, 9:01 pm, rajeev bharshetty rajeevr...@gmail.com wrote:
  @all : Could anyone explain it using the tree diagram . @nithin : 4 may
 not
  be th answer i am not able to plot into a tree satisfying those
 constarints
 
  On Thu, Aug 11, 2011 at 9:16 PM, Nitin Nizhawan 
 nitin.nizha...@gmail.comwrote:
 
 
 
 
 
   i guess answer is c. 4
 
   n*i+1
 
   On Thu, Aug 11, 2011 at 8:01 PM, rShetty rajeevr...@gmail.com wrote:
 
A complete n- array tree in which each node has n children or no
   children, let i be the number of internal nodes and L be the number of
   leaves in a complete n- array tree. If L=41 and i=10 what is the value
   of n.
 
   a. 3b. 6   c. 4
 
   How to solve such problems??
 
   --
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from 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
  Rajeev N B http://www.opensourcemania.co.cc
 
  *Winners Don't do Different things , they do things Differently*

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
Rajeev N B http://www.opensourcemania.co.cc

*Winners Don't do Different things , they do things Differently*

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

2011-08-11 Thread rajeev bharshetty
Queue 

On Thu, Aug 11, 2011 at 10:36 PM, Mani Bharathi manibharat...@gmail.comwrote:

 Which data structure is useful in transferring a given graph by breadth
 first  search.


 a. heapb. linkedlist   c. array   d. stack   e. queue

 --
 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/-/alG2ZKpLT64J.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
Rajeev N B http://www.opensourcemania.co.cc

*Winners Don't do Different things , they do things Differently*

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

2011-08-11 Thread paul suganthan
Total number of entries=10

The entries that may lead to 2 are 7,8,9,10,1,2

So its 6/10 = 0.6

Paul

On Thu, Aug 11, 2011 at 10:33 PM, Mani Bharathi manibharat...@gmail.comwrote:

 how?

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

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

2011-08-11 Thread paul suganthan
queue.Its level order traversal

On Thu, Aug 11, 2011 at 10:36 PM, Mani Bharathi manibharat...@gmail.comwrote:

 Which data structure is useful in transferring a given graph by breadth
 first  search.


 a. heapb. linkedlist   c. array   d. stack   e. queue

 --
 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/-/alG2ZKpLT64J.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] Data Structure Objective Question

2011-08-11 Thread Mani Bharathi
gethu da paul. :) :)

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

2011-08-11 Thread Rajeshwar Patra
how can we reverse a number using bitwise operators?

-- 
*Rajeshwar Patra,*
*MCA final year,*
*Nit Durgapur*

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

2011-08-11 Thread amit karmakar
* correction
(5*5(There are 5*5 nodes in level 2)-4(These became internal nodes..))

On Aug 11, 9:58 pm, amit karmakar amit.codenam...@gmail.com wrote:
 5 is possible.
 Considering root of the tree to be at level 0,
 level 1 and level 2 are completely filled.

 There are 5 internal nodes in level 1, (since all level 2 nodes are
 present)
 Now only (10 - 5(from level 1)+1(the root)) nodes are required.
 So choose 4 nodes from level 2 and make them interior node.
 So you get 4*5(4 nodes have 5 children) + (5*5(There are 5*5 nodes in
 level 2)-4(These became leaves)) leaves.

 Unfortunately 5 is not in the option

 On Aug 11, 7:31 pm, rShetty rajeevr...@gmail.com wrote:



   A complete n- array tree in which each node has n children or no
  children, let i be the number of internal nodes and L be the number of
  leaves in a complete n- array tree. If L=41 and i=10 what is the value
  of n.

  a. 3    b. 6   c. 4

  How to solve such problems??

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

2011-08-11 Thread paul suganthan
Answer is 5.
the relation is
No of leaf nodes = (n-1)*(no of internal nodes) + 1

Paul

On Thu, Aug 11, 2011 at 10:44 PM, amit karmakar
amit.codenam...@gmail.comwrote:

 * correction
 (5*5(There are 5*5 nodes in level 2)-4(These became internal nodes..))

 On Aug 11, 9:58 pm, amit karmakar amit.codenam...@gmail.com wrote:
  5 is possible.
  Considering root of the tree to be at level 0,
  level 1 and level 2 are completely filled.
 
  There are 5 internal nodes in level 1, (since all level 2 nodes are
  present)
  Now only (10 - 5(from level 1)+1(the root)) nodes are required.
  So choose 4 nodes from level 2 and make them interior node.
  So you get 4*5(4 nodes have 5 children) + (5*5(There are 5*5 nodes in
  level 2)-4(These became leaves)) leaves.
 
  Unfortunately 5 is not in the option
 
  On Aug 11, 7:31 pm, rShetty rajeevr...@gmail.com wrote:
 
 
 
A complete n- array tree in which each node has n children or no
   children, let i be the number of internal nodes and L be the number of
   leaves in a complete n- array tree. If L=41 and i=10 what is the value
   of n.
 
   a. 3b. 6   c. 4
 
   How to solve such problems??

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

2011-08-11 Thread Mani Bharathi
how do u say that they will lead to 2?

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

2011-08-11 Thread manvir siyo
please tell me about the pattern of writen  test for DE shaw ..

and also tell me on which thing they focus more..
please help me.. i really need ..
thnk u ..

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

2011-08-11 Thread manvir siyo
-- Forwarded message --
From: manvir siyo manis...@gmail.com
Date: Thu, Aug 11, 2011 at 10:54 PM
Subject: its very urgent
To: algogeeks@googlegroups.com


please tell me about the pattern of writen  test for DE shaw ..

and also tell me on which thing they focus more..
please help me.. i really need ..
thnk u ..

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

2011-08-11 Thread paul suganthan
if the hash function evaluates to 3 or 4 , collision occurs and by linear
probing they are put into 5(nearest free entry). Also 5 and 6 are empty.

But if the hash value points to 7,8,9,10 or 1 , they will be put into
2(nearest free entry).

On Thu, Aug 11, 2011 at 10:53 PM, Mani Bharathi manibharat...@gmail.comwrote:

 how do u say that they will lead to 2?

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

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

2011-08-11 Thread manvir siyo
please help me.. can u tell me regarding written test of De shaw company..
please if anyone knows please tell me.. please

On Thu, Aug 11, 2011 at 10:58 PM, paul suganthan
paul.sugant...@gmail.comwrote:

 if the hash function evaluates to 3 or 4 , collision occurs and by linear
 probing they are put into 5(nearest free entry). Also 5 and 6 are empty.

 But if the hash value points to 7,8,9,10 or 1 , they will be put into
 2(nearest free entry).


 On Thu, Aug 11, 2011 at 10:53 PM, Mani Bharathi 
 manibharat...@gmail.comwrote:

 how do u say that they will lead to 2?

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

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

2011-08-11 Thread manvir siyo
please tell me about the pattern of writen  test for DE shaw ..

and also tell me on which thing they focus more..
please help me.. i really need ..
thnk u ..

On Thu, Aug 11, 2011 at 11:01 PM, Naren s sweetna...@gmail.com wrote:

 not 100% sure if this is what you are asking for but here it goes.

 you have a number  (binary) and you want  (binary)?

 you want to use the xor operator ^

 value = 0xf0; // binary
 printf(before %d\n);
 value ^= 0xff; // binary
 printf(after%d\n);


 output:
 before 240
 after 15

 240 in binary is 
 15 in binary is 

 http://wiki.answers.com/Q/How_do_you_reverse_a_number_using_bitwise_operator#ixzz1Uk5fUjai


 On Thu, Aug 11, 2011 at 10:43 PM, Rajeshwar Patra 
 rajeshwarpa...@gmail.com wrote:

 how can we reverse a number using bitwise operators?

 --
 *Rajeshwar Patra,*
 *MCA final year,*
 *Nit Durgapur*

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




 --
 *Narayanan S,*
 B.E., C.S.E., (final year),
 College Of Engineering Guindy,
 Anna University,
 Chennai-25.

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

2011-08-11 Thread paul suganthan
You are trying to reverse the bits. not the number.
This will not work for bits also!

If given input is 1101 0011
you will get
0010 1100

On Thu, Aug 11, 2011 at 11:01 PM, Naren s sweetna...@gmail.com wrote:

 not 100% sure if this is what you are asking for but here it goes.

 you have a number  (binary) and you want  (binary)?

 you want to use the xor operator ^

 value = 0xf0; // binary
 printf(before %d\n);
 value ^= 0xff; // binary
 printf(after%d\n);


 output:
 before 240
 after 15

 240 in binary is 
 15 in binary is 
 http://wiki.answers.com/Q/How_do_you_reverse_a_number_using_bitwise_operator#ixzz1Uk5fUjai


 On Thu, Aug 11, 2011 at 10:43 PM, Rajeshwar Patra 
 rajeshwarpa...@gmail.com wrote:

 how can we reverse a number using bitwise operators?

 --
 *Rajeshwar Patra,*
 *MCA final year,*
 *Nit Durgapur*

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




 --
 *Narayanan S,*
 B.E., C.S.E., (final year),
 College Of Engineering Guindy,
 Anna University,
 Chennai-25.


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

2011-08-11 Thread Mani Bharathi
this is bit wise complement na?

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

2011-08-11 Thread manvir siyo
please tell me abt the pattern of de shaw company..
please

On Thu, Aug 11, 2011 at 11:06 PM, paul suganthan
paul.sugant...@gmail.comwrote:

 You are trying to reverse the bits. not the number.
 This will not work for bits also!

 If given input is 1101 0011
 you will get
 0010 1100

 On Thu, Aug 11, 2011 at 11:01 PM, Naren s sweetna...@gmail.com wrote:

 not 100% sure if this is what you are asking for but here it goes.

 you have a number  (binary) and you want  (binary)?

 you want to use the xor operator ^

 value = 0xf0; // binary
 printf(before %d\n);
 value ^= 0xff; // binary
 printf(after%d\n);


 output:
 before 240
 after 15

 240 in binary is 
 15 in binary is 

 http://wiki.answers.com/Q/How_do_you_reverse_a_number_using_bitwise_operator#ixzz1Uk5fUjai


 On Thu, Aug 11, 2011 at 10:43 PM, Rajeshwar Patra 
 rajeshwarpa...@gmail.com wrote:

 how can we reverse a number using bitwise operators?

 --
 *Rajeshwar Patra,*
 *MCA final year,*
 *Nit Durgapur*

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




 --
 *Narayanan S,*
 B.E., C.S.E., (final year),
 College Of Engineering Guindy,
 Anna University,
 Chennai-25.


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

2011-08-11 Thread mohit verma
Hey guys,

can anyone post some written and interview question asked by Novell?

-- 

*MOHIT VERMA*

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

2011-08-11 Thread manvir siyo
can anyone tell me abt the written test of d e shaw
On Thu, Aug 11, 2011 at 11:13 PM, mohit verma mohit89m...@gmail.com wrote:

 Hey guys,

 can anyone post some written and interview question asked by Novell?

 --
 
 *MOHIT VERMA*

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

2011-08-11 Thread Mani Bharathi
A complete n- array tree in which each node has n children or no children, 
let i be the number of internal nodes and L be the number of leaves in a 
complete n- array tree. If L=41 and i=10 what is the value of n.

a. 3b. 6   c. 4 

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

2011-08-11 Thread Mani Bharathi
int(* fun()) [row][ Col];
What should be the statement the for the above declarations 
a.fun() points to a two dimensional array
b.pointer *fun() points to a two dimensional array
c.pointer *fun() points to 1-dimensional array

-- 
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/-/3xkodl3aLvcJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Fwd: its very urgent

2011-08-11 Thread Raman
You have asked the same question everywhere on the group. This pisses me off

-- 
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/-/c-iGhaEyYxEJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Tree Objective Quiz

2011-08-11 Thread Rajkumar S
A parallel thread is running on the same question. Check that.

On Thu, Aug 11, 2011 at 11:16 PM, Mani Bharathi manibharat...@gmail.comwrote:

 A complete n- array tree in which each node has n children or no children,
 let i be the number of internal nodes and L be the number of leaves in a
 complete n- array tree. If L=41 and i=10 what is the value of n.

 a. 3b. 6   c. 4

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




-- 

Raj.

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

2011-08-11 Thread rShetty
This question is already discussed,please search the group before
asking questions ..

https://groups.google.com/group/algogeeks/browse_thread/thread/2597c9730a43977b

Thank you

On Aug 11, 10:46 pm, Mani Bharathi manibharat...@gmail.com wrote:
 A complete n- array tree in which each node has n children or no children,
 let i be the number of internal nodes and L be the number of leaves in a
 complete n- array tree. If L=41 and i=10 what is the value of n.

 a. 3    b. 6   c. 4

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

2011-08-11 Thread arvind kumar
b.

On Thu, Aug 11, 2011 at 11:18 PM, Mani Bharathi manibharat...@gmail.comwrote:

 int(* fun()) [row][ Col];
 What should be the statement the for the above declarations
 a.fun() points to a two dimensional array
 b.pointer *fun() points to a two dimensional array
 c.pointer *fun() points to 1-dimensional array

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

2011-08-11 Thread Don
int A[100];
int dist[100];
int N;

void findDist(int p, int d)
{
if (d  dist[p])
{
dist[p] = d;
for(int i = 0; i  p; ++i)
if ((i+A[i]) = p)
findDist(i,d+1);
}
}

int main(int argc, char* argv[])
{
int i;
int location = 0;

printf(Number of elements:);
scanf(%d, N);
for(i = 0; i  N; ++i)
{
printf(Element %d:, i);
scanf(%d,A[i]);
}

for(i = 0; i  N; ++i)
dist[i] = N;
findDist(N-1, 0);

for(i = 1; i  N; ++i)
if (dist[i] == (dist[location]-1))
{
printf(Move %d to location %d\n, i-location, i);
location = i;
}

return 0;
}

On Aug 11, 3:07 am, Algo Lover algolear...@gmail.com wrote:
 Given an array, start from the first element and reach the last by
 jumping. The jump length can be at most the value at the current
 position in the array. Optimum result is when you reach the goal in
 minimum number of jumps.

 For ex:
 Given array A = {2,3,1,1,4}
 possible ways to reach the end (index list)
 i) 0,2,3,4 (jump 2 to index 2, then jump 1 to index 3 then 1 to index
 4)
 ii) 0,1,4 (jump 1 to index 1, then jump 3 to index 4)

 Since second solution has only 2 jumps it is the optimum result.

 My solution is for any index i loop from i to i + A[i]
                                                find an index j where
 (j + A[j]) is maximum for all j.
                                                make i=j;

 This solution in O(n) i suppose coz we are picking each element twice
 in the worst case.

 I have read a O(n^2) DP solution for this problem.Is there any
 case where my approach will fail ?

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

2011-08-11 Thread ashmantak
3.

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

2011-08-11 Thread Don
What exactly do you mean by reverse a number?
Please define what that means and give an example.
Don

On Aug 11, 12:13 pm, Rajeshwar Patra rajeshwarpa...@gmail.com wrote:
 how can we reverse a number using bitwise operators?

 --
 *Rajeshwar Patra,*
 *MCA final year,*
 *Nit Durgapur*

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

2011-08-11 Thread Mani Bharathi
wrong. 5

-- 
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/-/XVpBpl5qdfEJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Fwd: its very urgent

2011-08-11 Thread shady
not actually, it is just to discuss algorithms .
and then people ask why they get banned, o.O
On Thu, Aug 11, 2011 at 11:19 PM, manvir siyo manis...@gmail.com wrote:

 then answer me na.. have u any probs on that.. this group is for all
 queries and doubts


 On Thu, Aug 11, 2011 at 11:18 PM, Raman raman.u...@gmail.com wrote:

 You have asked the same question everywhere on the group. This pisses me
 off

 --
 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/-/c-iGhaEyYxEJ.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] Tree Objective Quiz

2011-08-11 Thread Pratz mary
ya thats wat i got too
On 11 August 2011 23:26, Mani Bharathi manibharat...@gmail.com wrote:

 wrong. 5

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

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

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

2011-08-11 Thread Mani Bharathi
A retailer has n stones by which he can mesure or(weigh)all the quantities 
from (1kg to 121kg in integer only) keeping these stones on either side of 
the balance what is the minimum value of n.
 A.3 B.4   C. 5 D. 11

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

2011-08-11 Thread Rajeshwar Patra
thats wat i wanna know is it possible to reverse a number using bitwise
operators

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

2011-08-11 Thread Tarun Arya
Rajeev sir,
0.6 is correct :)

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

2011-08-11 Thread Krishna ganjigatti
Don't remember But the paper was just awesome One question was  why do 
u want to join GS..?? In descriptive paper

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

2011-08-11 Thread Raman
How is this formula obtained?

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

2011-08-11 Thread manvir siyo
 output of the program?

#define prn(a) printf(%d,a)
#define print(a,b,c) prn(a), prn(b), prn(c)
#define max(a,b) (a

main()
{
int x=1, y=2;
print(max(x++,y),x,y);
print(max(x++,y),x,y);
}

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

2011-08-11 Thread Nitin Nizhawan
I am also getting , 5 as answer now. here is what I did.

In any n-ary tree we can add one internal node by adding n-children to any
one of its leaf nodes. This operation creates one internal node and at the
cost one leaf node and adds n new leaf nodes.
L(i) be leaf nodes in a tree with i internal nodes, then
L(i+1) = L(i) + n  - 1
L(0) = 1 , since tree with root node has 0 internal nodes and one leave node
L(i) = L(0) + i*(n-1)
or L(i) = i*(n-1) + 1

On Thu, Aug 11, 2011 at 11:34 PM, Raman raman.u...@gmail.com wrote:

 How is this formula obtained?

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

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

2011-08-11 Thread sagar pareek
C

On Thu, Aug 11, 2011 at 11:30 PM, Mani Bharathi manibharat...@gmail.comwrote:

 A retailer has n stones by which he can mesure or(weigh)all the quantities
 from (1kg to 121kg in integer only) keeping these stones on either side of
 the balance what is the minimum value of n.
  A.3 B.4   C. 5 D. 11

 --
 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/-/NQe0FChNS-kJ.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT 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.



Re: [algogeeks] Quantz

2011-08-11 Thread Mani Bharathi
how?

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

2011-08-11 Thread Srinivas

1 3 9 27 81
5 weights enough
On Aug 11, 11:13 pm, Mani Bharathi manibharat...@gmail.com wrote:
 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.



Re: [algogeeks] output

2011-08-11 Thread Anika Jain
this code has so many errors

On Thu, Aug 11, 2011 at 11:36 PM, manvir siyo manis...@gmail.com wrote:

  output of the program?

 #define prn(a) printf(%d,a)
 #define print(a,b,c) prn(a), prn(b), prn(c)
 #define max(a,b) (a

 main()
 {
 int x=1, y=2;
 print(max(x++,y),x,y);
 print(max(x++,y),x,y);
 }

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

2011-08-11 Thread Tarun Arya
a^=b^=a^=b;
a and b are integer inputs
Tarun

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

2011-08-11 Thread mani walia
this is the question in de shaw written test

On Thu, Aug 11, 2011 at 11:48 PM, Anika Jain anika.jai...@gmail.com wrote:

 this code has so many errors

 On Thu, Aug 11, 2011 at 11:36 PM, manvir siyo manis...@gmail.com wrote:

  output of the program?

 #define prn(a) printf(%d,a)
 #define print(a,b,c) prn(a), prn(b), prn(c)
 #define max(a,b) (a

 main()
 {
 int x=1, y=2;
 print(max(x++,y),x,y);
 print(max(x++,y),x,y);
 }

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

2011-08-11 Thread Mani Bharathi
What will be the output of the following program
#include
int main()
{
int m=10,p;
p=incre(incre (incre (++) incre) incre)
Printf(%d, *P);
return 0;
}
incre (int m)
{
m+=2;
return(m-2);
}

how?

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

2011-08-11 Thread Mani Bharathi
Two person each make a single throw with a pair of dice. The probability 
that the sum of numbers if the dice of their throws are unequal is 
A. 575/648  B. 273/432  c. 264/816.

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

2011-08-11 Thread Mani Bharathi
ABCD is a parallelogram and E is the middle point of side AD EC meets BD at 
O. If the area if the parallelogram is 24 units then the area of  EOD is ?

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

2011-08-11 Thread Ashwini Singh
1kg --1
2kg --1
3kg --2
4kg --1

On Thu, Aug 11, 2011 at 11:13 AM, Mani Bharathi manibharat...@gmail.comwrote:

 how?

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

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




-- 
with regards,
Ashwini kumar singh
ECE Final yr.
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.



Re: [algogeeks] reverse

2011-08-11 Thread Rahul
@Tarun
Rahul
@Tarun , How Do You Extract the digits of the two digit numbers using bit
wise operators


@Tarun , How Do You Extract the digits of the two digit numbers using bit
wise operators ;

And btw , the expression in the way it is written does not works for all
langugaes
On Thu, Aug 11, 2011 at 11:50 PM, Tarun Arya tarun@gmail.com wrote:

 a^=b^=a^=b;
 a and b are integer inputs
 Tarun

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

2011-08-11 Thread paul suganthan
yaa..this is bitwise complement !

On Thu, Aug 11, 2011 at 11:11 PM, Mani Bharathi manibharat...@gmail.comwrote:

 this is bit wise complement na?

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

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



  1   2   >