Re: [algogeeks] How will you implement a stack using a priority queue. Push and pop should be in O(1)

2013-05-25 Thread rohit jangid
you are doing it correct.


On Sat, May 25, 2013 at 5:37 PM, Nishant Pandey 
nishant.bits.me...@gmail.com wrote:

 I am not getting the y priority Q is getting used for this question, as in
 case of P Queue, things are arranged as per the priority so when we will
 insert the data we can simply increament the priority.

 Algo would be like this :

 Enque(q, data) {
   push(q, data, increrase the prioroty);
 }

 int Deque() {
 return pop();
 }

 here higher priority  one shuld be poped first.

 PLEASE SUGGEST if any good approach some one is having other than this ?


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






-- 
Rohit Jangid
http://rohitjangid.com
Graduate
Deptt. of Computer Engineering
NSIT, Delhi University, India

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




Re: [algogeeks] Math problem

2013-05-15 Thread rohit jangid
after few attempts I think you must be getting stuck where you need a^3 +
b^3 + c^3 value in terms of abc, C1, and C2  which is possible using this
identity--

(a+b+c)³=(a³+b³+c³)+3[(a+b+c)(ab+ac+bc)-abc]
refer this link for the proof
http://math.stackexchange.com/questions/288965/show-that-abc-a-b-c-abcabacbc

ffdfdff

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




Re: [algogeeks] clearing n-stages of a game.

2013-05-04 Thread rohit jangid
a very standard dp problem . try to formulate recurrence relation . it has
been mentioned a couple of times on stackoverflow as well .
On May 5, 2013 8:28 AM, sreekanth guru sreekanth.i...@gmail.com wrote:

 There n stages of a game. At each stage i you will come across a devil.
 Each devil has its own energy E(i) and price P(i). If you have energy X
 which is greater than the devils energy at that stage you can win over the
 devil without any energy loss or You just pay the price to devil then it
 will give its energy to you and you can go to next stage.   In second case
 devils energy is added to your existing energy.

 What is the minimum price need to clear all rounds.

 P.S. Initially you don't have any energy. At level i you don't know the
 energies of devils present at i to n.


 -Sreekanth

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to algogeeks+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




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




Re: [algogeeks] Re: Amazon Interview Questions

2013-03-12 Thread rohit jangid
these questions were asked for software dev. in amazon ? which round .
looks like straight easy questions...


On Sun, Mar 10, 2013 at 5:58 PM, Nishant Pandey 
nishant.bits.me...@gmail.com wrote:

 Ans to *Boundary traversal of a tree. Write the code.

 *1) you need to for preoder oder for left most tree with flag and post
 order traversal for right most tree with flag.
 2) the role of flag would be to decide wther to print or not like in case
 of left subtree ,flag would be tree as u knw that
 in preorder traversal left element would be boundary and once u go
 right make it false .. same for right subtree:

 Code snippet would look like this :

 void printleft (struct node *root, bool flag) {
   if (!root) return;
   if (flag || (!root-left  !root-right)) {
 cout root-data;
   }
   printleft(root-left, true);
   printleft(root-right, false);
 }

 this is preorder for left subtree , do post order for right subtree like :

 void printright (struct node *root, bool flag) {
   if (!root) return;
   printright(root-left, false);
   printright(root-right, true);
   if (flag || (!root-left  !root-right)) cout root-data;

 }
 *
 *let me knw if anything seems confusing.

 On Sun, Mar 10, 2013 at 4:59 PM, Nishant Pandey 
 nishant.bits.me...@gmail.com wrote:

 i have few questions regarding ur problems pratik :

 1) A tree with only parent pointer, how to find LCA?
 Doubt : do u mean only root of the tree is given , i am assuming root
 along with two nodes address whose lca need to
  find too is given , i am right ?

 2) Find top k searched elements from a continuous stream of data.
 Doubt : what do u mean by top k search element can u please explain
 little bit with exmple.


 I would love to post solution for you provided clear my doubts 
 may i knw which Amazon's round questions are they ?


 On Mon, Feb 18, 2013 at 1:28 AM, Tushar tushicom...@gmail.com wrote:

 It looks as if you have just pasted some Amazon interview questions on
 this forum.
 These are pretty common questions.
 Try to come up with your own answers.
 Do some research on google and previous posts on this forum. You'll get
 answers to all of them.

 If you have some idea and want to discuss that, then post different
 posts for each questions as arun recommended along with your understanding
 of the question and your approach.

 All the best


 On Saturday, 9 February 2013 14:45:35 UTC+5:30, Pratik Mehta wrote:

 Hi All,
 I need ur help in solving few questions.

 Would you please help me out *BY GIVING THE ALGORITHM AND THE LOGIC
 BEHIND IT and it's DEEP EXPLANATION IF POSSIBLE?*


 *
 *

  *a. Kadane’s Algo.*

  *
 *

 *b. Linked-list intersection point.*

 *
 [A tree with only parent pointer, how to find LCA?]
 *

 *

 *

 *
 c. Design a stack which can perform findMax in O(1).
 *

 *

 *

 *d. Set of stocks for each day have been given. Need to find the days
 on which I buy and sell share to earn max profit, alongwith finding the max
 profit.*


 *
 e. Find top k searched elements from a continuous stream of data.
 *

 *

 *

 *f. Given a linked-list and 2 integers k  m. Reverse the linked-list
 till k elements and then traverse till m elements and repeat.*

 *Write production quality code.*

 *
 *

 *g. An array of elements have been given. Find for each element, first
 max element to its right.*

 *
 *

 *h. Boundary traversal of a tree. Write the code.*


 Please help me out...

 Thanks in advance...

 Thanks  Regards,
 Pratik Mayur Mehta.

  --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to algogeeks+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.





  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to algogeeks+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.






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

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [algogeeks] help with o/p why 0 comes???

2013-03-04 Thread rohit jangid
yup , it is showing
0
0

on ideone as well . so my gcc compiler is i686-apple-darwin11-llvm-gcc-4.2.
that can be the reason . from here it appears 0 is just a coincidence and
it depends on compiler implementation . C doesn't define any such behavior.



On Mon, Mar 4, 2013 at 3:45 PM, Shubham Sandeep
s.shubhamsand...@gmail.comwrote:

 on my system every time o/p is 0
 using ubuntu 10.04 ,gcc compiler


 On Mon, Mar 4, 2013 at 7:34 AM, rohit jangid rohit.nsi...@gmail.comwrote:

 output for me for the previous snippet

 localhost:slingshot rohitjangid$ ./a.out
 1799476872
 1799474584
 localhost:slingshot rohitjangid$ ./a.out
 1710327432
 1710325144
 localhost:slingshot rohitjangid$ ./a.out
 1856128648
 1856126360
 localhost:slingshot rohitjangid$ ./a.out
 1724065416
 1724063128


 On Mon, Mar 4, 2013 at 7:33 AM, rohit jangid rohit.nsi...@gmail.comwrote:

 yeah true . one interesting thing I noticed is that if you run this code

 #includestdio.h
 int main()
 {
 int i = 0;
 do {
 printf (%d\n,(float)1);
 }while(i++  1);
 return 0;
 }

 one would expect same output in both the rows but surprisingly it came
 different for me every time .
 any clues .. why ?




 On Fri, Mar 1, 2013 at 12:05 PM, Karthikeyan V.B kartmu...@gmail.comwrote:

 O/p will not be 0.

 1.00 is the result which when read as %d takes the decimal value of
 float 1.00 stored in memory - it will not be 1.00 or 0.

 Since float is not stored as direct binary in memory as integer is
 stored, instead there's a separate procedure for storing float as binary in
 memory

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to algogeeks+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.






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




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

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to algogeeks+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.






 --
 Regards,
 SHUBHAM SANDEEP
 IT 3rd yr.
 NIT ALD.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to algogeeks+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.






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

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [algogeeks] Re: Algo Question

2013-03-03 Thread rohit jangid
take this example
let the gaurds demand be

5 2 7 2 9

first guard : we have no choice but to give him 5
second guard : we have choice , either skip him and pay 7 to next guard or
pay him and save 7 from third guard .. thus clearly multiple solutions
exist but we have to give optimal one. { hint for dp }

if we know the solution for upto i-th guard, we can extend this solution to
i+1-th guard
solution here represents all the possible amounts that one can spend till
i-th guard, extending that will give us all the possible amounts for i+1 th
guard and we just select the minimum amount.  thus optimal substructure is
also there.

using the below code , the output for example is 12 with possible sequence.

guard 1 : 5
guard 2 : skip
guard 3 : 7
guard 4 :skip
guard 5 :skip


// non optimized code -purely for demonstration purpose -
#include stdio.h
#include stdarg.h
#define size 5
#define amount 1000 // maximum amount asked by all the gaurds combined
int solution[size][amount];

int main (int argc, char const *argv[])
{
int arr[] = {5,2,7,2,9};
int min, i, j;
int sum = 0;
for(i = 0; isize; i++) {
sum += arr[i];
}
solution[0][arr[0]] = 1;

for(i = 1; i size; i++) {
for(j = 0; j= sum; j++) {
if(solution[i-1][j] == 1) {
if(j  arr[i]) {
solution[i][j] = 1;
}
solution[i][j + arr[i]] = 1;
}
}
}
min = 10;   // infinite value
for(i = 0; i  sum; i++) {
if(solution[size - 1][i]  i  min)
min = i;
}
printf(%d, min);
return 0;
}

@marti check the solution for other testcases , I'll post the optimized
version after that.


On Wed, Feb 27, 2013 at 1:04 AM, Saurabh Paliwal 
saurabh.paliwa...@gmail.com wrote:

 Please mention the initial condition.
 I mean I wouldn't pay to any guard (assuming their demands are all
 positive numbers)


 On Wed, Feb 27, 2013 at 12:39 AM, marti amritsa...@gmail.com wrote:

 Sure..
 http://stackoverflow.com/questions/14686745/guards-and-demand



 On Monday, February 4, 2013 5:54:19 PM UTC+5:30, marti wrote:

 You have N guards in a line each with a demand of coins.You can skip
 paying a guard only if his demand is lesser than what you have totally paid
 before reaching him.Find the least number of coins you spend to cross all
 guards.
 I think its a DP problem but cant come up with a formula.Another
 approach would be to binary search on the answer but how do I verify if no.
 of coins is a possible answer?

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to algogeeks+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.






 --
  -Saurabh Paliwal

B-Tech. Comp. Science and Engg.

IIT ROORKEE

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to algogeeks+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.






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

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [algogeeks] help with o/p why 0 comes???

2013-03-03 Thread rohit jangid
yeah true . one interesting thing I noticed is that if you run this code

#includestdio.h
int main()
{
int i = 0;
do {
printf (%d\n,(float)1);
}while(i++  1);
return 0;
}

one would expect same output in both the rows but surprisingly it came
different for me every time .
any clues .. why ?




On Fri, Mar 1, 2013 at 12:05 PM, Karthikeyan V.B kartmu...@gmail.comwrote:

 O/p will not be 0.

 1.00 is the result which when read as %d takes the decimal value of
 float 1.00 stored in memory - it will not be 1.00 or 0.

 Since float is not stored as direct binary in memory as integer is stored,
 instead there's a separate procedure for storing float as binary in memory

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to algogeeks+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.






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

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [algogeeks] help with o/p why 0 comes???

2013-03-03 Thread rohit jangid
output for me for the previous snippet

localhost:slingshot rohitjangid$ ./a.out
1799476872
1799474584
localhost:slingshot rohitjangid$ ./a.out
1710327432
1710325144
localhost:slingshot rohitjangid$ ./a.out
1856128648
1856126360
localhost:slingshot rohitjangid$ ./a.out
1724065416
1724063128


On Mon, Mar 4, 2013 at 7:33 AM, rohit jangid rohit.nsi...@gmail.com wrote:

 yeah true . one interesting thing I noticed is that if you run this code

 #includestdio.h
 int main()
 {
 int i = 0;
 do {
 printf (%d\n,(float)1);
 }while(i++  1);
 return 0;
 }

 one would expect same output in both the rows but surprisingly it came
 different for me every time .
 any clues .. why ?




 On Fri, Mar 1, 2013 at 12:05 PM, Karthikeyan V.B kartmu...@gmail.comwrote:

 O/p will not be 0.

 1.00 is the result which when read as %d takes the decimal value of
 float 1.00 stored in memory - it will not be 1.00 or 0.

 Since float is not stored as direct binary in memory as integer is
 stored, instead there's a separate procedure for storing float as binary in
 memory

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to algogeeks+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.






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




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

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [algogeeks] need help??

2012-09-22 Thread Rohit Singhal
the very best book...no doubt..Khalid Mughal.

On Sat, Sep 22, 2012 at 2:10 PM, Ravi Ranjan ravi.cool2...@gmail.comwrote:

 khalid mugal - A Programmers guide to Java certification

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

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



Re: [algogeeks] JAVA PROGRAM ERROR

2012-08-21 Thread Rohit Singhal
what error it is showing

On Wed, Aug 22, 2012 at 12:41 AM, Rajesh Kumar testalgori...@gmail.comwrote:

 class StringTimes
 {
 public static void main(String args[])
 {
 String str=Hi;
 long i=2;
 String get;
 get=stringTimes(str,i);
 System.out.println(get);
 }
 public static String stringTimes(String str,long x)
 {
   int i;
  String set=str;
  for(i=0;in-1;i++)
  {
  set+=str;
  }
  return set;
 }
 }

 OUTPUT should be like:HiHi

 but it gives error plz someone help me
 --
 Regards
 Rajesh Kumar


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




-- 
Rohit Singhal
09211931609

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

2011-10-29 Thread Rohit Srivastava
remains same

On Sat, Oct 29, 2011 at 12:21 PM, praveen raj praveen0...@gmail.com wrote:

 amount displaced by (boat +man + suitcase) = amount displaced by
 (boat+man)  + amount displaced by suitcase

 therefore no change of level...

 With regards,

 Praveen Raj
 DCE-IT 3rd yr
 735993
 praveen0...@gmail.com




 On Thu, Sep 15, 2011 at 4:24 PM, hary rathor harry.rat...@gmail.comwrote:

 no increase or no decrease

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

2011-09-28 Thread rohit
Is anybody know about sapient working culture?

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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-09-25 Thread Rohit Upadhyaya
thanks every1 for their explanations especially vishwaas and anup
ghatage

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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-09-22 Thread Rohit Upadhyaya
int main()
{
int a=256;
char *p=a;
*++p=2;
printf(%d,a);
return(0);
}

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



Re: [algogeeks]

2011-09-22 Thread rohit jangid
isn't that simply because if little indian endian way of storing bytes in
memory

initial --   0001 0..
finally--   0010 0..
On Sep 22, 2011 5:38 PM, Rohit Upadhyaya mailtoroh...@gmail.com wrote:

 int main()
 {
 int a=256;
 char *p=a;
 *++p=2;
 printf(%d,a);
 return(0);
 }

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

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



Re: [algogeeks] plz help

2011-09-22 Thread rohit jangid
got 45 on linux
than tried with fflush(stdout) and got 9 which is correct . so I guess that
both child and parent process getting the same buffer and thus resulting in
more number of hello

correct answer is 9 as already mentioned
On Sep 21, 2011 7:57 PM, sush57 sushaant...@gmail.com wrote:
 main()
 {
 int tmp;
 for(i=0;i9;i++)
 {
 tmp=fork();
 if(tmp0)
 break;
 printf(Hello);
 }
 }


 what's the output and how does this work

 can u give few other questions using fork...

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


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



Re: [algogeeks] Re: Interview Questions

2011-09-15 Thread Rohit Upadhyaya
Try This 1-:

#includestdio.h
#includestdlib.h
int main()
{
 int w=10;
 int *p=w;
 int *x;
x=(int *)malloc(sizeof(int)*1);
 *x=1000;
 int *y;
y=(int *)malloc(sizeof(int));
 *y=100;
 printf(%d %d %d,*x,*p,*y);
 return 0;
}

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



Re: [algogeeks] what is the output????

2011-09-14 Thread Rohit Upadhyaya
can any1 explain me the fork() function???

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



Re: [algogeeks] C output

2011-09-14 Thread Rohit Upadhyaya
for a 32 bit it is 4 ,3 and for 16 bit it is 2,3 and 64 bit it is 8,3..
also strlen(d) gives 3 bcz the coding of fn strlen() is such that as it
encounters null it will terminate..so irrespective of machine it prints 3 as
null at 4th place

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

2011-09-10 Thread Rohit jalan
How is this one ??

int a[9]={9,7,6,5,3,23,14,2,4}
n=9
int *p,*q;
p=a;
for(q=a;in;q++,i++);
ReverseArray(p,q)

p=a[0];
q=a[n-1-k]
ReverseArray(p,q)

p=a[n-k];
q=a[n-1]
ReverseArray(p,q)

void ReverseArray(int *l,int *r)
{
int temp;
while(lr)
{
temp=*l;
*l=*r;
*r=temp
l++;
r--;
}
}


Thanks  Regards,
-Rohit

On Sat, Sep 10, 2011 at 5:24 PM, bharatkumar bagana 
bagana.bharatku...@gmail.com wrote:

 swap k elements form 1 to k and n-k to n respectively...
 ex: k=3
temp=k;

 int a[9]= {9,7,6,5,3,23,14,2,4} ; has become {14,2,4,5,3,23,9,7,6};

 now swap first k elements with k+1 to 2k elements ...now k=2k+1 , do this 
 step again up to (kn-temp)...
 at last {5,3,23,14,2,4,9,7,6,} ;

 Time :O(n) and space O(1).



 On Sat, Sep 10, 2011 at 7:15 AM, kumar raja rajkumar.cs...@gmail.comwrote:

 @sarath:
 I did not get u .Could u please explain it with the example.


 On 10 September 2011 03:39, sarath prasath prasathsar...@gmail.comwrote:

 consider this approach..
 first reverse the entire array...
 so it will be.. 4,2,14,23,3,5,6,7,9
 and u want to shift k times right so
 u have to cut the array as n-k  and reverse both the sides u ll get it..
 so in ur scenario we are reversing upto the element 5 in array and
 reversing the remaining elements..
 hope the complexity is of o(n)..



 On Sat, Sep 10, 2011 at 3:17 PM, kumar raja rajkumar.cs...@gmail.comwrote:

 U have used c[3] extra array.It is already known solution. so it is
 using O(k) space .i want the solution with constant space..


 On 10 September 2011 02:08, Ishan Aggarwal 
 ishan.aggarwal.1...@gmail.com wrote:

 Solution :-





 void main(){int a[9]= {9,7,6,5,3,23,14,2,4} ;int n = 3;int c[3];int i;int 
 k =0;for ( i=0;i3;i++)
 c[i]= a[i];for(i=3;i9;i++)
 a[i-3] =a[i];for(i=9-3;i9;i++)
 a[i] = c[k++];for(i=0;i9;i++)printf 
 http://www.opengroup.org/onlinepubs/009695399/functions/printf.html(\n%d,a[i]);}


 On Sat, Sep 10, 2011 at 2:09 PM, kumar raja 
 rajkumar.cs...@gmail.comwrote:

 Given an array of 'n' values you need to circular shift it 'k' times
 towards left.

 Input : 9 7 6 5 3 23 14  2  4
 output : 5 3 23 14 2  4 9 7  6

 n=9 , k= 3

 constraints : Time complexity O(n)
 Space complexity O(1)

 The solutions with O(kn) time complexity and
 O(n) complexity with O(k) space complexity are already available.

 I want the O(n) solution with constant space..
 --
 Regards
 Kumar Raja
 M.Tech(SIT)
 IIT Kharagpur,
 10it60...@iitkgp.ac.in
 7797137043.
 09491690115.

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




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

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




 --
 Regards
 Kumar Raja
 M.Tech(SIT)
 IIT Kharagpur,
 10it60...@iitkgp.ac.in
 7797137043.
 09491690115.

  --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
 Kumar Raja
 M.Tech(SIT)
 IIT Kharagpur,
 10it60...@iitkgp.ac.in
 7797137043.
 09491690115.

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




 --

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


  --
 You received

Re: [algogeeks] Circular Left shift

2011-09-10 Thread Rohit jalan
This can also be done:


for( i=0; ik;i++)
{
b[i]=a[i];
}

for (;in;i++)
{
a[i-k]=a[i];
}
while((i-k)n)
{
a[i-k]=b[i];
}

But extra array is used here.

On Sat, Sep 10, 2011 at 5:30 PM, Rohit jalan jalanha...@gmail.com wrote:


 How is this one ??


 int a[9]={9,7,6,5,3,23,14,2,4}
 n=9
 int *p,*q;
 p=a;
 for(q=a;in;q++,i++);
 ReverseArray(p,q)

 p=a[0];
 q=a[n-1-k]
 ReverseArray(p,q)

 p=a[n-k];
 q=a[n-1]
 ReverseArray(p,q)

 void ReverseArray(int *l,int *r)
 {
 int temp;
 while(lr)
 {
 temp=*l;
 *l=*r;
 *r=temp
 l++;
 r--;
 }
 }


 Thanks  Regards,
 -Rohit


 On Sat, Sep 10, 2011 at 5:24 PM, bharatkumar bagana 
 bagana.bharatku...@gmail.com wrote:

 swap k elements form 1 to k and n-k to n respectively...
 ex: k=3
temp=k;

 int a[9]= {9,7,6,5,3,23,14,2,4} ; has become {14,2,4,5,3,23,9,7,6};


 now swap first k elements with k+1 to 2k elements ...now k=2k+1 , do this 
 step again up to (kn-temp)...
 at last {5,3,23,14,2,4,9,7,6,} ;


 Time :O(n) and space O(1).



 On Sat, Sep 10, 2011 at 7:15 AM, kumar raja rajkumar.cs...@gmail.comwrote:

 @sarath:
 I did not get u .Could u please explain it with the example.


 On 10 September 2011 03:39, sarath prasath prasathsar...@gmail.comwrote:

 consider this approach..
 first reverse the entire array...
 so it will be.. 4,2,14,23,3,5,6,7,9
 and u want to shift k times right so
 u have to cut the array as n-k  and reverse both the sides u ll get it..
 so in ur scenario we are reversing upto the element 5 in array and
 reversing the remaining elements..
 hope the complexity is of o(n)..



 On Sat, Sep 10, 2011 at 3:17 PM, kumar raja 
 rajkumar.cs...@gmail.comwrote:

 U have used c[3] extra array.It is already known solution. so it is
 using O(k) space .i want the solution with constant space..


 On 10 September 2011 02:08, Ishan Aggarwal 
 ishan.aggarwal.1...@gmail.com wrote:

 Solution :-






 void main(){int a[9]= {9,7,6,5,3,23,14,2,4} ;int n = 3;int c[3];int 
 i;int k =0;for ( i=0;i3;i++)
 c[i]= a[i];for(i=3;i9;i++)
 a[i-3] =a[i];for(i=9-3;i9;i++)
 a[i] = c[k++];for(i=0;i9;i++)printf 
 http://www.opengroup.org/onlinepubs/009695399/functions/printf.html(\n%d,a[i]);}


 On Sat, Sep 10, 2011 at 2:09 PM, kumar raja rajkumar.cs...@gmail.com
  wrote:

 Given an array of 'n' values you need to circular shift it 'k' times
 towards left.

 Input : 9 7 6 5 3 23 14  2  4
 output : 5 3 23 14 2  4 9 7  6

 n=9 , k= 3

 constraints : Time complexity O(n)
 Space complexity O(1)

 The solutions with O(kn) time complexity and
 O(n) complexity with O(k) space complexity are already available.

 I want the O(n) solution with constant space..
 --
 Regards
 Kumar Raja
 M.Tech(SIT)
 IIT Kharagpur,
 10it60...@iitkgp.ac.in
 7797137043.
 09491690115.

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




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

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




 --
 Regards
 Kumar Raja
 M.Tech(SIT)
 IIT Kharagpur,
 10it60...@iitkgp.ac.in
 7797137043.
 09491690115.

  --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
 Kumar Raja
 M.Tech(SIT)
 IIT Kharagpur,
 10it60...@iitkgp.ac.in
 7797137043.
 09491690115.

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




 --

 **Please do not print this e

Re: [algogeeks] Circular Left shift

2011-09-10 Thread Rohit jalan
@BharathKumar: extremely sorry dude .. will not do this again .. Can you
forgive me ? :p
On Sep 10, 2011 12:09 PM, bharatkumar bagana bagana.bharatku...@gmail.com
wrote:
 @rohit : why don't u have a look at the older posts before replying some
 thing ...ok .. I'm sorry if u are hurt ..
 what is the time complexity and space complexity of u'r older post ..

 On Sat, Sep 10, 2011 at 8:03 AM, Rohit jalan jalanha...@gmail.com wrote:

 This can also be done:


 for( i=0; ik;i++)
 {
 b[i]=a[i];
 }

 for (;in;i++)
 {
 a[i-k]=a[i];
 }
 while((i-k)n)
 {
 a[i-k]=b[i];
 }

 But extra array is used here.


 On Sat, Sep 10, 2011 at 5:30 PM, Rohit jalan jalanha...@gmail.com
wrote:


 How is this one ??


 int a[9]={9,7,6,5,3,23,14,2,4}
 n=9
 int *p,*q;
 p=a;
 for(q=a;in;q++,i++);
 ReverseArray(p,q)

 p=a[0];
 q=a[n-1-k]
 ReverseArray(p,q)

 p=a[n-k];
 q=a[n-1]
 ReverseArray(p,q)

 void ReverseArray(int *l,int *r)
 {
 int temp;
 while(lr)
 {
 temp=*l;
 *l=*r;
 *r=temp
 l++;
 r--;
 }
 }


 Thanks  Regards,
 -Rohit


 On Sat, Sep 10, 2011 at 5:24 PM, bharatkumar bagana 
 bagana.bharatku...@gmail.com wrote:

 swap k elements form 1 to k and n-k to n respectively...
 ex: k=3
 temp=k;

 int a[9]= {9,7,6,5,3,23,14,2,4} ; has become {14,2,4,5,3,23,9,7,6};



 now swap first k elements with k+1 to 2k elements ...now k=2k+1 , do
this step again up to (kn-temp)...
 at last {5,3,23,14,2,4,9,7,6,} ;



 Time :O(n) and space O(1).



 On Sat, Sep 10, 2011 at 7:15 AM, kumar raja rajkumar.cs...@gmail.com
wrote:

 @sarath:
 I did not get u .Could u please explain it with the example.


 On 10 September 2011 03:39, sarath prasath prasathsar...@gmail.com
wrote:

 consider this approach..
 first reverse the entire array...
 so it will be.. 4,2,14,23,3,5,6,7,9
 and u want to shift k times right so
 u have to cut the array as n-k and reverse both the sides u ll get
 it..
 so in ur scenario we are reversing upto the element 5 in array and
 reversing the remaining elements..
 hope the complexity is of o(n)..



 On Sat, Sep 10, 2011 at 3:17 PM, kumar raja rajkumar.cs...@gmail.com
wrote:

 U have used c[3] extra array.It is already known solution. so it is
 using O(k) space .i want the solution with constant space..


 On 10 September 2011 02:08, Ishan Aggarwal 
 ishan.aggarwal.1...@gmail.com wrote:

 Solution :-







 void main(){int a[9]= {9,7,6,5,3,23,14,2,4} ;int n = 3;int c[3];int
i;int k =0;for ( i=0;i3;i++)
 c[i]= a[i];for(i=3;i9;i++)
 a[i-3] =a[i];for(i=9-3;i9;i++)
 a[i] = c[k++];for(i=0;i9;i++)printf 
http://www.opengroup.org/onlinepubs/009695399/functions/printf.html
(\n%d,a[i]);}


 On Sat, Sep 10, 2011 at 2:09 PM, kumar raja 
 rajkumar.cs...@gmail.com wrote:

 Given an array of 'n' values you need to circular shift it 'k'
times
 towards left.

 Input : 9 7 6 5 3 23 14 2 4
 output : 5 3 23 14 2 4 9 7 6

 n=9 , k= 3

 constraints : Time complexity O(n)
 Space complexity O(1)

 The solutions with O(kn) time complexity and
 O(n) complexity with O(k) space complexity are already available.

 I want the O(n) solution with constant space..
 --
 Regards
 Kumar Raja
 M.Tech(SIT)
 IIT Kharagpur,
 10it60...@iitkgp.ac.in
 7797137043.
 09491690115.

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




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

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




 --
 Regards
 Kumar Raja
 M.Tech(SIT)
 IIT Kharagpur,
 10it60...@iitkgp.ac.in
 7797137043.
 09491690115.

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
 Kumar Raja
 M.Tech(SIT)
 IIT Kharagpur,
 10it60...@iitkgp.ac.in
 7797137043.
 09491690115.

 --
 You

Re: [algogeeks] logical and physical address

2011-09-10 Thread rohit kumar
please explain ...

On Sat, Sep 10, 2011 at 5:10 PM, bharatkumar bagana 
bagana.bharatku...@gmail.com wrote:

 physical address:19 bits(10+9)
 logical address : 15 bits(6+9)


 On Sat, Sep 10, 2011 at 6:48 AM, ravi maggon maggonr...@gmail.com wrote:

 we have page table having 64 entries of 10 bits each. and page size is of
 512 bytes.
 tell the no of bits required for physical and logical address.

 --

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

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




 --

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


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


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



[algogeeks] Kth largest element

2011-09-08 Thread Rohit jalan
How to find out Kth largest element in an array ?

-- 
Thanks  Regards :
ROHIT JALAN

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

2011-09-08 Thread Rohit jalan
@Brijesh: Can you help me with a code ? or atleast pseudo code ?  How are
you going to keep on inserting the elements ?

Thanks  Regards,
-Rohit

On Thu, Sep 8, 2011 at 10:38 PM, Brijesh brijeshupadhyay...@gmail.comwrote:

 make a max heap of size K , and keep inserting all the elements in it.. and
 at last the root will be the k-th largest element ! O(nlonk)


 On Thursday, 8 September 2011 22:32:52 UTC+5:30, Sandeep Chugh wrote:

 wat abt creating a max heap?  and then deleting root element k-1 times..
 after then root contains kth largest element

 On Thu, Sep 8, 2011 at 10:28 PM, Piyush Kapoor pkje...@gmail.com wrote:

 use max heap ,it will take n + k*logn


 On Thu, Sep 8, 2011 at 10:25 PM, Rohit jalan jalan...@gmail.com wrote:

 How to find out Kth largest element in an array ?

 --
 Thanks  Regards :
 ROHIT JALAN

  --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algo...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+...@googlegroups.com**.

 For more options, visit this group at http://groups.google.com/**
 group/algogeeks?hl=en http://groups.google.com/group/algogeeks?hl=en.




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

 For more options, visit this group at http://groups.google.com/**
 group/algogeeks?hl=en http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/XYeQcjZW-isJ.

 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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 :
ROHIT JALAN
B.E. Graduate,
Computer Science Department,
RVCE, Bangalore

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

2011-09-08 Thread Rohit jalan
Okay. We can do it with min Heap.

1) Build a Min Heap MH of the first k elements (arr[0] to arr[k-1]) of the
given array. O(k)
2) For each element, after the kth element (arr[k] to arr[n-1]), compare it
with root of MH.
a) If the element is greater than the root then make it root and call heapify
http://www.personal.kent.edu/%7Ermuhamma/Algorithms/MyAlgorithms/Sorting/heapSort.htmfor
MH
b) Else ignore it.
O((n-k)*logk)
3) Finally, MH has k largest elements and root of the MH is the kth largest
element.

Thanks  Regards,
-Rohit

On Thu, Sep 8, 2011 at 11:20 PM, praveen raj praveen0...@gmail.com wrote:

 @brijesh...Tht would...be... O(klogn)

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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 :
ROHIT JALAN
B.E. Graduate,
Computer Science Department,
RVCE, Bangalore

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

2011-09-06 Thread ROHIT SINGHAL
due to this singleton class i lost 6.5 lpa opportunity :( in Hcentive noida

On Tue, Sep 6, 2011 at 12:58 PM, rahul vatsa vatsa.ra...@gmail.com wrote:

 there is no restriction at all, you can create n no of objects. A member
 function can call a private constructor any number of times.

 Just 1 single object is created bcoz this is the property of singleton
 class.
 A singleton class is a class which ensures the class has only one instance
  it provides a global point of access to it.  that it provides through a
 public static member function.
 This member function when invoked , first checks if the single instance has
 already been create, if yes it doesn't create a new 1, it gives you back the
 already created one, so even if you call it multiple times, you get the same
 object. nd thatz basically the intent behind.

 If you want to have more than one objects, you can modify this member
 function  can do that.




 On Mon, Sep 5, 2011 at 12:45 PM, Neha Singh neha.ndelhi.1...@gmail.comwrote:

 Guys hv a doubt, plz clarify ..
 You mentioned that if a class has a private constructor then the object of
 that class can be created using call to a static method which internally
 calls the constructor and returns its reference. I can't understand why only
 1 object can be created as mentioned by you. As in, we can call the static
 method multiple times and create multiple objects..

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

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

2011-09-06 Thread ROHIT SINGHAL
:) thanks for such gud words guys

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

 ya dont be upset if some one who is not as good as u get a job and u don
 get it ... think positively ... think that the company don deserve u and
 start working on ur weak areas

 On Tue, Sep 6, 2011 at 2:34 PM, siddharam suresh 
 siddharam@gmail.comwrote:

 my personal experience.
 guys don't regret while placements,
 it wont bring any work-ability in the preparation.
 always look for what was missing in the last interview, prepare well.

 I didnt prepare because of the initial failure in the placements(ended up
 where i did not planed). I wish that wont happen with anybody.

 Thank you,
 Sid.



 On Tue, Sep 6, 2011 at 2:19 PM, rahul vatsa vatsa.ra...@gmail.comwrote:

 :D
 may be u lost this to gt something better :-)


 On Tue, Sep 6, 2011 at 4:32 AM, ROHIT SINGHAL rohitksingha...@gmail.com
  wrote:

 due to this singleton class i lost 6.5 lpa opportunity :( in Hcentive
 noida


 On Tue, Sep 6, 2011 at 12:58 PM, rahul vatsa vatsa.ra...@gmail.comwrote:

 there is no restriction at all, you can create n no of objects. A
 member function can call a private constructor any number of times.

 Just 1 single object is created bcoz this is the property of singleton
 class.
 A singleton class is a class which ensures the class has only one
 instance  it provides a global point of access to it.  that it provides
 through a public static member function.
 This member function when invoked , first checks if the single instance
 has already been create, if yes it doesn't create a new 1, it gives you 
 back
 the already created one, so even if you call it multiple times, you get 
 the
 same object. nd thatz basically the intent behind.

 If you want to have more than one objects, you can modify this member
 function  can do that.




 On Mon, Sep 5, 2011 at 12:45 PM, Neha Singh 
 neha.ndelhi.1...@gmail.com wrote:

 Guys hv a doubt, plz clarify ..
 You mentioned that if a class has a private constructor then the
 object of that class can be created using call to a static method which
 internally calls the constructor and returns its reference. I can't
 understand why only 1 object can be created as mentioned by you. As in, 
 we
 can call the static method multiple times and create multiple objects..

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


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




-- 
Regards:
Rohit Singhal

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

2011-09-03 Thread rohit
how many bytes are allocated by following code?

#includealloc.h
#define col 4
#define row 3

int main()
{
int(*p)[col];
p=(int(*)[col])malloc(row*sizeof(*p));

return 0;
}

please explain answer?

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



Re: [algogeeks] Amazon - Coding Round-2 Qn

2011-08-31 Thread rohit
Q1.

NODE* head //points to the bst(if it exists)

void exist_bst(NODE *tree)
{
if(tree != NULL)
{
if(tree-left-info  tree-info   tree-right-info = tree-info)
{  
   if(check(tree))
   head = tree;
}
else
{
 exist_bst(tree-left);
 exist_bst(tree-right);
}
}
}

int check(NODE *root)
{
if(root-left == NULL  root-right == NULL)
return TRUE;

if(tree-left-info = tree-info  || tree-right-info  tree-info)
return FALSE;

else return (check(tree-left) || check(tree-right));

}

I havn't run this on system and this code is subject to more optimisation. 
This was just to give you a fair idea

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

2011-08-31 Thread rohit
123456789

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



Re: [algogeeks] Re: Static variable

2011-08-31 Thread rohit
None of us is right

https://ideone.com/KBVuM

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



Re: [algogeeks] Re: Static variable

2011-08-31 Thread rohit
while(--i  0) //suppose i = 1 here, so --i becomes 0, hence the condition 
fails...so it will go 1 step back in recursion
{
main();
printf(%d,i);
}

it will execute

printf(%d,i) of prev recursion where i=0 now, so 0 gets printed...now 
again the condition is checked i=0, thrfore --i becomes -1, so condition 
fails

it now executes printf(%d,i) of still prev recursion and i=-1 herethis 
continues...
I hope this clarifies

-- 
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/-/bAkVsFcLH_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] Re: Static variable

2011-08-31 Thread rohit
+1 to chris

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

2011-08-31 Thread rohit
Where does a static variable get allocated in memory..? 
Like automatic variables get stack, objects allocated through malloc/calloc 
get memory from heap...wt abt static variable?

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

2011-08-31 Thread rohit
Someone please provide the recursion tree for it..thanks

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/_o5nQen8VmAJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: loop in link list

2011-08-31 Thread Rohit jalan
Hi All,

Find below the function to detect a loop in a linked list and the point from
where loop occurs.

#includestdio.h
#includestdlib.h

/* Link list node */
struct node
{
int data;
struct node* next;
};

/* Function to remove loop. Used by detectAndRemoveLoop() */
void LoopPoint(struct node *, struct node *);

/* This function detects and removes loop in the list
  If loop was there in the list then it returns 1,
  otherwise returns 0 */
int detectLoop(struct node *list)
{
struct node  *slow_p = list, *fast_p = list;

while (slow_p  fast_p  fast_p-next)
{
slow_p = slow_p-next;
fast_p  = fast_p-next-next;

/* If slow_p and fast_p meet at some point then there
   is a loop */
if (slow_p == fast_p)
{
LoopPoint(slow_p, list);

/* Return 1 to indicate that loop is found */
return 1;
}
}

/* Return 0 to indeciate that ther is no loop*/
return 0;
}

/* Function to find loop point.
 loop_node -- Pointer to one of the loop nodes
 head --  Pointer to the start node of the linked list */
void removeLoop(struct node *loop_node, struct node *head)
{
   struct node *ptr1;
   struct node *ptr2;

   /* Set a pointer to the beging of the Linked List and
  move it one by one to find the first node which is
  part of the Linked List */
   ptr1 = head;
   while(1)
   {
 /* Now start a pointer from loop_node and check if it ever
   reaches ptr2 */
 ptr2 = loop_node;
 while(ptr2-next != loop_node  ptr2-next != ptr1)
 {
 ptr2 = ptr2-next;
 }

 /* If ptr2 reahced ptr1 then there is a loop. So break the
loop */
 if(ptr2-next == ptr1)
break;

 /* If ptr2 did't reach ptr1 then try the next node after ptr1 */
 else
   ptr1 = ptr1-next;
   }

/* ptr1-data is a point where loop occurs.*/

/* to remove loop*/

ptr2-next=NULL
}


On Thu, Sep 1, 2011 at 9:12 AM, Don dondod...@gmail.com wrote:

 @Rahul
 The problem is to determine if there is a loop. That means there might
 not be. And if there isn't, you really shouldn't dump core.
 Don

 On Aug 31, 10:17 pm, Siddhartha Banerjee thefourrup...@gmail.com
 wrote:
  how can head2-next be null in a linked list witha loop???
  i mean it would just go around in circles right???

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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 :
ROHIT JALAN
B.E. Graduate,
Computer Science Department,
RVCE, Bangalore

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

2011-08-29 Thread rohit
Someone please share their recruitment procedure and the topics they focus 
on..

-- 
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/-/nJZwHH_s2j4J.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 to save a binary search tree space efficiently

2011-08-28 Thread rohit
How to save a binary search tree space efficiently and built it
again , just tell any idea.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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-28 Thread rohit
Why does the following code not give an error?

#includestdio.h
void fun(char *a) //array decays to pointer here
{ 
 a[0] = 'a'; 
 printf(%s\n,a); 
  

}
int main()
{
char p[]=hello;
fun(p);
getch();
}

if i write something like this in main

char *arr=hello
arr[0] = 'r';  //this gives runtime error and i know why

-- 
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/-/rxboAmI8lEUJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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-28 Thread rohit
Thanks for your reply himanshu, ...I am aware of the above stated fact but 
my doubt is that when i pass this char array to a function and accept it as 
a char pointer (char *a), and then when write a[0] = 'a', why don't i get an 
error?

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

2011-08-28 Thread rohit
@kamakshi: your algo is wrong

Take the test case as  {4,3,2,5,8,7}

op should be 16 (4,5,7) but ur op = 15

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

2011-08-27 Thread rohit
how is  this program convert number to binary equivalent
int main()
{
unsigned int num =23 ;
int i;
for(i=0;i16;i++)
printf(%d\n,(numi115)?1:0);
}

please explain 

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

2011-08-26 Thread ROHIT SINGHAL
its been a while tat i had gave test bt i remebr quant was full of geometry
application so clear ur concept for geometry. and in logical they give this
kinda alphanumeric prob. my advice in quant and logical correct 3-4
questions out of 20 each u gonna get a gud percentile. for sure.

On Fri, Aug 26, 2011 at 10:59 AM, prateek gupta prateek21590gu...@gmail.com
 wrote:

 prepare well for di,
 quant and va are easy but di is really hard.
 1 ques that often appears in their test is
  ABC
  *   EFG
 -
  7JK
L4N
 PQR
 ---
 ---
 some conditions will be given and you have to find which number does a
 particular character given in ques represents.
  On Thu, Aug 25, 2011 at 9:49 AM, prasanna rockslife2...@gmail.comwrote:

 Hi
 Whosoever have taken the elitmus test, pls share the type of questions
 asked in the test.

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


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




-- 
Regards:
Rohit Singhal

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

2011-08-26 Thread rohit
Please share  Process and experience of tejas Network for software
profile.
Thanks

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



[algogeeks] Elitmus test Help

2011-08-24 Thread rohit
Is anybody have any idea about pattern of elitmus test , Is It a C
programming test or General aptitude test?

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



[algogeeks] Tree quuestion

2011-08-24 Thread rohit
How to find the distance of a node from the root of the tree??
Give algorithm.

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

2011-08-24 Thread ROHIT SINGHAL
well i got 85 % in that. Its lil tricky test u need to clear ur geometry
skills for quant and prepare DI properly for logical portion.

On Thu, Aug 25, 2011 at 9:49 AM, prasanna rockslife2...@gmail.com wrote:

 Hi
 Whosoever have taken the elitmus test, pls share the type of questions
 asked in the test.

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




-- 
Regards:
Rohit Singhal

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

2011-08-24 Thread ROHIT SINGHAL
i guss CAT se bhi zyada diff hai Elitmus.

On Thu, Aug 25, 2011 at 12:56 AM, Khyati Gupta khyatigupt...@gmail.comwrote:

 Any body has sample paper of E-lithmus


 On Thu, Aug 25, 2011 at 12:17 AM, Abhishek Sharma 
 jkabhishe...@gmail.comwrote:

 similar to CAT though the level is little low... no technical questions
 are asked..


 On Wed, Aug 24, 2011 at 11:50 PM, Akanksha . akanksha...@gmail.comwrote:

 It is  a general aptitude test.. they ask u ques on quant, verbel n
 problems solving skills.. prepare well if u r planning to take this
 test as ques r tough..

 On Wed, Aug 24, 2011 at 11:45 PM, rohit rajuljain...@gmail.com wrote:
  Is anybody have any idea about pattern of elitmus test , Is It a C
  programming test or General aptitude test?
 
  --
  You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.
 
 

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


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




 --
 Khyati Gupta

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




-- 
Regards:
Rohit Singhal

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

2011-08-24 Thread rohit
Most commonly used algo to detect a loop in a linked list is to have two 
pointers running, one at double the speed of other and check if they 
meet..What is the time complexity of this algorithm?

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

2011-08-22 Thread Rohit Srivastava
no
some girls may not be beautiful or all of them may be beautiful
based on your premise the conclusion is incorrect since you havent spoken
about the rest of the girls so you dont know nething about them

On Mon, Aug 22, 2011 at 1:12 PM, Apoorve Mohan apoorvemo...@gmail.comwrote:

 U cannot say that conclusion is true...it may or may not be true...


 On Mon, Aug 22, 2011 at 1:03 PM, tanuj chawla houndhun...@gmail.comwrote:

 conclusion is not true...
 may be all the girls are beautiful..

 On Sun, Aug 21, 2011 at 3:37 AM, Rahul raikra...@gmail.com wrote:

 http://philosophy.lander.edu/logic/syll_prob.html
 Rahul


 On Sun, Aug 21, 2011 at 6:16 AM, Dave dave_and_da...@juno.com wrote:

 @Geek_one: In fact, the statement All girls are beautiful does not
 imply that Some girls are beautiful unless we know that the set of
 girls is non-empty. For the statement All girls are beautiful is
 true if there are no girls. But Some girls are beautiful asserts the
 existence of at least one girl who is beautiful.

 Dave

 On Aug 20, 3:08 am, geek_one abhishekgupta.it...@gmail.com wrote:
  i have a doubt,
  i think after seeing some girls we can make the assumption that some
 are
  beautiful.
  since we have not come across with all the girls, so can anyone can't
 say
  that some are not beautiful.

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




 --
 regards

 Apoorve Mohan

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

2011-08-22 Thread rohit
#includestdio.h

#define max(a,b) (ab?a:b)


int main()
{

 int j=max(3+2,2+8);
 printf(%d,j);

return 0;
}

why this program show output as 9 ? please 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] GSOC

2011-08-20 Thread rohit jangid
join google's mailing list, it has all the information.

On Tue, Aug 16, 2011 at 7:00 PM, saurabh chhabra
saurabh131...@gmail.com wrote:
 can anyone help me in preparing for GSOC(Summer of Code),2012?
 Please give me a description of what exactly it is and what all we
 need to know to get selected in it.
 kindly throw some light.

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

2011-08-18 Thread ROHIT SINGHAL
Guys i m going to appear for ebay any question set or any kinda help for the
same

-- 
Regards:
Rohit Singhal

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

2011-08-18 Thread ROHIT SINGHAL
ebay job location- chennai

On Thu, Aug 18, 2011 at 11:28 PM, Swathi chukka.swa...@gmail.com wrote:

 Is it ebay or paypal? Job location?

 On Thu, Aug 18, 2011 at 11:26 PM, ROHIT SINGHAL rohitksingha...@gmail.com
  wrote:

 Guys i m going to appear for ebay any question set or any kinda help for
 the same

 --
 Regards:
 Rohit Singhal

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

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

2011-08-18 Thread ROHIT SINGHAL
@siva thanks bro for info.
@rahul thru Amcat so its offcampus tey given call to specific students

On Fri, Aug 19, 2011 at 1:12 AM, Rahul Tiwari rahultiwari6...@gmail.comwrote:

 @rohit singhal
 off-campus or on-campus ?
 if on-campus ---mention ur college plz 






 --
 Rahul Tiwari aka   DONE 
 B Tech Final Year
 Information Technology
 Motilal Nehru National Institute of Technology , Allahabad
 9838339030

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

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

2011-08-17 Thread Rohit Srivastava
+1 to nitin

On Wed, Aug 17, 2011 at 2:48 PM, Vijay Kansal vijaykans...@gmail.comwrote:

 my bad 2^(n-1)...

 On Aug 17, 2:17 pm, Vijay Kansal vijaykans...@gmail.com wrote:
  @nitin it must be 2^n i think
 
  On Aug 17, 3:48 am, Bharat Kul Ratan bharat.kra...@gmail.com wrote:
 
 
 
 
 
 
 
   It might be useful:
 http://www.artofproblemsolving.com/Wiki/index.php/Partition_%28combin...

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

2011-08-17 Thread Rohit Srivastava
0.788

On Wed, Aug 17, 2011 at 5:23 PM, priya ramesh 
love.for.programm...@gmail.com wrote:

 A mistake from my side as well!
 Got 78.8% :)

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


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

2011-08-17 Thread Rohit Srivastava
+1 to nitin

On Wed, Aug 17, 2011 at 6:02 PM, Romil ... vamosro...@gmail.com wrote:

 People this is not the way to approach this one. This question seems to be
 unfair. Take the number to be 1939 which also leaves 69 as the remainder
 when divided by 935 but when it is divided by 38, the remainder is only 1.
 There is definitely some mistake. Also there doesn't seem to be a
 mathematical way to solve this.


 On Wed, Aug 17, 2011 at 5:58 PM, priya ramesh 
 love.for.programm...@gmail.com wrote:

 i solved it the same way you solved it. Took the same exmpl too :)

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




 --
 Romil


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

2011-08-17 Thread rohit kumra
Please mail it to me also!!

On Aug 17, 2:22 pm, Sanjay Rajpal srn...@gmail.com wrote:
 @Raman : mail kar de bhai abhi.

 Sanjay Kumar
 B.Tech Final Year
 Department of Computer Engineering
 National Institute of Technology Kurukshetra
 Kurukshetra - 136119
 Haryana, India

 On Wed, Aug 17, 2011 at 2:20 AM, raman gugnani
 ramangugnani@gmail.comwrote:







  sanjay bhai mjse le liyo. am having the buk nw.

  On 17/08/2011, Sanjay Rajpal sanjay.raj...@live.in wrote:
   @Shady : when u'll post the links, just leave a msg at srn...@gmail.com.
                  Thanks in advance :)
   Sanjay Kumar
   B.Tech Final Year
   Department of Computer Engineering
   National Institute of Technology Kurukshetra
   Kurukshetra - 136119
   Haryana, 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.

  --
  Raman Gugnani

  Computer Engg. Deptt.
  Under Graduate
  NIT Kurukshetra

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

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



Re: [algogeeks] an amazing amazon question!

2011-08-17 Thread Rohit Srivastava
logic plz?

On Wed, Aug 17, 2011 at 10:35 PM, sagar pareek sagarpar...@gmail.comwrote:

 16, 61, 106  average speed is 45 miles/hour


 On Wed, Aug 17, 2011 at 10:28 PM, priya ramesh 
 love.for.programm...@gmail.com wrote:

 A car is traveling at a uniform speed.The driver sees a milestone showing
 a 2-digit number. After traveling for an hour the driver sees another
 milestone with the same digits in reverse order.After another hour the
 driver sees another milestone containing the same two digits. What is the
 average speed of the driver?

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


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

2011-08-17 Thread rohit
No third time he just say same digit are appearing but you write 
interchanging .
correct me if i am wrong!

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

2011-08-16 Thread rohit


#includestdio.hconst char *fun();
int main()
{
char *ptr = fun();
return 0;
}const char *fun()
{
return Hello;
}


Why doesn't this code give error??

-- 
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/-/qeUTNwGNKfwJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Non recursive preorder and postorder

2011-08-15 Thread rohit
Can anyone give algorithm for non recursive preorder and postorder??

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

2011-08-14 Thread rohit
I came accross a problem where i need to hash strings..
What is the best way to hash strings??

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

2011-08-14 Thread rohit
Well I came across a great hashing algorithm, known as djb2 hash for hashing 
strings..would like to share it:

int get_hash(char *s)
{
int hash = 0;
while(c = *s++)
{
hash = ((hash  5) + hash) ^ c;
}

return hash;
}

this can be done for each individual string to be hashed..

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

2011-08-14 Thread rohit
Nice one..

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

2011-08-13 Thread rohit jangid
@shashank
acc to me the problem can be done easily using greedy approach
https://ideone.com/dYbUd  ( it is your non optimal greedy solution
with just one line added )
couldn't find any case where the above code is giving wrong answer .

if you know any case, please let me know.

I wrote a dp O(n^2) solution before that but found that same can be
done using greedy as well

On Fri, Aug 12, 2011 at 7:57 PM, WgpShashank shashank7andr...@gmail.com wrote:
 A Top Down Memoization DP Algorithm Will be As  Follow

 Step 1. Declare an array of size N say jump[N];
 where ith position indicates the number of jumps requires to reach from
 start to this (ith) position in array .

 Step 2. Initialize jump[0]=0; indicates to reach oth location form starting
 location (3which is obviuosly 0) we don't requires any jump.

 Step 3. Check size of array and value at 0th location in array For first
 index, optimum number of jumps will be zero. Please note that if value at
 first index is zero, we can’t jump to any element and return infinite.so
 these tow cases are
   A.If size of array==0 means array is of zero size;
  B.If value at zero then we can't jump or we can't proceed
 to next location

 Step 4. Run Through Loop for remaining elements in array and Initialize
 jump[i] as infinite. where
    1=i=N.
    Sub-step 4A. (Please Note j runs in inner loop until i=j+a[j] )
     if jump[i]jump[j]+1 update jump[i]  repeat until ji (this
 whole processing will happen in
     inner loop). e.g. for each ith element this loop will run 
 tries to figure out optimal/minimum
    number of jumps required to reach this ith position from starting
 of array .

 Step 5. After running above algorithm we will return array[n-1] that will
 show number of jumps required
 to reach last elemnt in array from start.

 Time Complexity O(N^2)
 Space Complexity O(N)
 Hope You Can Convert it into Production Code

 Do Notify me via mail if i missed anything ??

 Regards
 Shashank Mani Computer Science Is Awesome So Why I Write Code
 Computer Science
 Birla institute of Technology Mesra




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



Re: [algogeeks] String Doubt

2011-08-13 Thread Rohit Srivastava
2.

On Sat, Aug 13, 2011 at 7:24 PM, Raman raman.u...@gmail.com wrote:

 Which of the following statements are correct about the below declarations?
 *char *p = Sanjay;
 char a[] = Sanjay;*1:There is no difference in the declarations and both
 serve the same purpose.2:*p* is a non-const pointer pointing to a
 non-const string, whereas *a* is a const pointer pointing to a non-const
 string.3:The pointer *p* can be modified to point to another string,
 whereas the individual characters within array *a* can be changed.4:In
 both cases the *'\0'* will be added at the end of the string Sanjay.

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

2011-08-13 Thread Rohit Srivastava
also 3,4

On Sat, Aug 13, 2011 at 7:30 PM, Rohit Srivastava access2ro...@gmail.comwrote:

 2.


 On Sat, Aug 13, 2011 at 7:24 PM, Raman raman.u...@gmail.com wrote:

 Which of the following statements are correct about the below
 declarations?
 *char *p = Sanjay;
 char a[] = Sanjay;* 1: There is no difference in the declarations and
 both serve the same purpose. 2: *p* is a non-const pointer pointing to a
 non-const string, whereas *a* is a const pointer pointing to a non-const
 string. 3: The pointer *p* can be modified to point to another string,
 whereas the individual characters within array *a* can be changed. 4: In
 both cases the *'\0'* will be added at the end of the string Sanjay.

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

2011-08-13 Thread Rohit Srivastava
my bad only 3,4

On Sat, Aug 13, 2011 at 7:41 PM, rajeev bharshetty rajeevr...@gmail.comwrote:

 3,4


 On Sat, Aug 13, 2011 at 7:39 PM, Raman raman.u...@gmail.com wrote:

 In statement 2, isn't p pointing to const string, as we cannot modify the
 characters of the string.

 --
 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/-/FU-nrcTBpCoJ.

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


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

2011-08-13 Thread rohit jangid
I can only say that above code is wrong, check this code of mine, I
have tested more cases and all are working,
https://ideone.com/pEBs8
see if you can find any bug in this one .

thanks.

On Sat, Aug 13, 2011 at 8:03 PM, WgpShashank shashank7andr...@gmail.com wrote:
 @rohit , I think we will get some cases where greedy won't work check out
 its giving 3 jumps still

 https://ideone.com/6UWW1

 checked in hurray , if anything wrong do send me over gmail ?

 Regards
 Shashank Mani Computer Science Is Awesome So Why I Write Code
 Computer Science
 Birla institute of Technology Mesra

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



Re: [algogeeks] Re: Jumping Puzzle

2011-08-13 Thread rohit jangid
ok check this, https://ideone.com/hZboG
there may be bugs in coding, but I'm quite sure that algo is correct
need to check more cases though
but working on all the cases discussed here
is there any proof that greedy won't work in this case?

On Sat, Aug 13, 2011 at 11:03 PM, rohit jangid rohit.nsi...@gmail.com wrote:
 found some bugs , will repost it


 On Sat, Aug 13, 2011 at 10:55 PM, rohit jangid rohit.nsi...@gmail.com wrote:
 I can only say that above code is wrong, check this code of mine, I
 have tested more cases and all are working,
 https://ideone.com/pEBs8
 see if you can find any bug in this one .

 thanks.

 On Sat, Aug 13, 2011 at 8:03 PM, WgpShashank shashank7andr...@gmail.com 
 wrote:
 @rohit , I think we will get some cases where greedy won't work check out
 its giving 3 jumps still

 https://ideone.com/6UWW1

 checked in hurray , if anything wrong do send me over gmail ?

 Regards
 Shashank Mani Computer Science Is Awesome So Why I Write Code
 Computer Science
 Birla institute of Technology Mesra

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




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




-- 
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] c output doubt

2011-08-12 Thread rohit

int main()
{
int a[5]={1,2,3,4,5};
printf(%d,a[4]-a[0])
}
why it show 4 not 16?

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



[algogeeks] Re: c output doubt

2011-08-12 Thread rohit
Thanks a lot

On Aug 12, 11:25 am, Avinash Dharan avinashdha...@gmail.com wrote:
 Pointer incrementation and subtraction are done in terms of memory blocks
 and not addresses of memory.
 For example,

 int *p;
 p++;

 The pointer here jumps to the next integer location and not the next address
 in memory.
 Similarly,pointer subtraction will give the difference in indexes and not
 the memory addresses.
 If you try subtracting an integer pointer and a float pointer, it will be an
 error.







 On Fri, Aug 12, 2011 at 11:34 AM, rohit rajuljain...@gmail.com wrote:

  int main()
  {
  int a[5]={1,2,3,4,5};
  printf(%d,a[4]-a[0])
  }
  why it show 4 not 16?

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

2011-08-10 Thread rohit
main()
{
int m,n;
m=3+max(2,3);
n=2*max(3,2);
printf(“%d,%d”,m,n);
}
ans:-m=2,n=3
why output is this???

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



[algogeeks] output help

2011-08-09 Thread Rohit Srivastava
#includestdio.h
#includeconio.h

int main()
{
struct value
{
int bit1:1;
int bit3:4;
int bit4:4;
}bit={1,2,2};
printf(%d %d %d\n,bit.bit1,bit.bit3,bit.bit4);
getche();
return 0;
}
 the above code gives output : -1 2 2
any idea why???

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

2011-08-09 Thread Rohit Srivastava
hey guys thanks got it!!


On Tue, Aug 9, 2011 at 12:49 PM, sanjay ahuja sanjayahuja.i...@gmail.comwrote:

 Int bit3:4 will be read as lower order 4 bits of bit3 and this will be
 treated as int (signed). Thus lower order bit of bit3 which is 2, are
 0010 which is 2
 try with
 1) int bit3:2, output will be -2
 2) unsigned int bit3:2, output will be 2.

 I hope it is cleared now

 On 8/9/11, Rohit Srivastava access2ro...@gmail.com wrote:
  #includestdio.h
  #includeconio.h
 
  int main()
  {
  struct value
  {
  int bit1:1;
  int bit3:4;
  int bit4:4;
  }bit={1,2,2};
  printf(%d %d %d\n,bit.bit1,bit.bit3,bit.bit4);
  getche();
  return 0;
  }
   the above code gives output : -1 2 2
  any idea why???
 
  --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 

 --
 Sent from my mobile device

 Sanjay Ahuja,
 Analyst, Financing Prime Brokerage
 Nomura Securities India Pvt. Ltd

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

2011-08-09 Thread Rohit Srivastava
@aditi did they mention any thing about miss penalty also in the question ??

On Tue, Aug 9, 2011 at 11:48 AM, aditi garg aditi.garg.6...@gmail.comwrote:

 @aditya and dipankar: the ans given ws 500ns that is why i posted dis
 ques...i ws getting the same ans...


 On Tue, Aug 9, 2011 at 9:45 AM, ankit sambyal ankitsamb...@gmail.comwrote:

 @aditya : can u explain how u got c part as the answer for question 2

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




 --
 Aditi Garg
 Undergraduate Student
 Electronics  Communication Divison
 NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
 Sector 3, Dwarka
 New Delhi


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

2011-08-09 Thread Rohit Srivastava
yup !!! it will increase the avg access time

On Tue, Aug 9, 2011 at 1:39 PM, aditi garg aditi.garg.6...@gmail.comwrote:

 @Rohit:No...i directly copy pasted the ques...nothing else mentioned...and
 what if thr ws sm miss penalty?what wud be the change in soution?


 On Tue, Aug 9, 2011 at 1:37 PM, Rohit Srivastava 
 access2ro...@gmail.comwrote:

 @aditi did they mention any thing about miss penalty also in the question
 ??


 On Tue, Aug 9, 2011 at 11:48 AM, aditi gayrg 
 aditi.garg.6...@gmail.comwrote:

 @aditya and dipankar: the ans given ws 500ns that is why i posted dis
 ques...i ws getting the same ans...


 On Tue, Aug 9, 2011 at 9:45 AM, ankit sambyal ankitsamb...@gmail.comwrote:

 @aditya : can u explain how u got c part as the answer for question 2

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




 --
 Aditi Garg
 Undergraduate Student
 Electronics  Communication Divison
 NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
 Sector 3, Dwarka
 New Delhi


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




 --
 Aditi Garg
 Undergraduate Student
 Electronics  Communication Divison
 NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
 Sector 3, Dwarka
 New Delhi


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

2011-08-09 Thread rohit jain
@aditi

For the first question.
The answer will be ((0.97 *2) + (0.03*2) +(0.03*100)) i.e 5 ns.
The reason is that cache is accessed in the case of miss as well, so
we need to include that time as well.

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



Re: [algogeeks] problem regarding output??

2011-08-09 Thread Rohit Srivastava
typecast only temporarily changes the pointer type of LHS but cannot change
that of RHS or even LHS permanently

On Tue, Aug 9, 2011 at 5:36 PM, ankit sambyal ankitsamb...@gmail.comwrote:

 The typecasting tells the compiler that the void pointer is now pointing to
 an integer and when we use this pointer to access the integer it takes value
 from 4 bytes. But when we try to increment that pointer, it will point to
 the next byte.  Try taking k as pointer to double instead of void, u will c
 the same result.

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

2011-08-09 Thread rohit jain
In memory heirachy, whenever some data is to be read, first data is to
be searched in M1, if the data is found in M1 then system returns the
value from there and counted as a hit. If the  value is not found in
M1 i.e. Miss for M1 then it accesses M2 and returns the value from
there. Since nothing is given about miss in M2, I am assuming that it
is the main memory and there is no miss there.

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

2011-08-09 Thread Rohit Srivastava
@aditi since in the hierarchy m1 comes first so if it is a hit then we dont
need to check m2 but in case of a miss 0.03*2 seconds are wasted while
searching in m1 then that value is looked for in m2
so i suppose the best answer is given by rohit jain. unless there is some
missing data

On Tue, Aug 9, 2011 at 5:41 PM, aditi garg aditi.garg.6...@gmail.comwrote:

 @Rohit: we wont include the miss time fr M2 then?


 On Tue, Aug 9, 2011 at 5:36 PM, rohit jain rohitjain.n...@gmail.comwrote:

 @aditi

 For the first question.
 The answer will be ((0.97 *2) + (0.03*2) +(0.03*100)) i.e 5 ns.
 The reason is that cache is accessed in the case of miss as well, so
 we need to include that time as well.

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




 --
 Aditi Garg
 Undergraduate Student
 Electronics  Communication Divison
 NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
 Sector 3, Dwarka
 New Delhi


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


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



Re: [algogeeks] MS question

2011-08-09 Thread Rohit Srivastava
google on RLE (run length encoding) its almost similar!!

On Tue, Aug 9, 2011 at 6:46 PM, ankit sambyal ankitsamb...@gmail.comwrote:

 @raghavan: ur approach uses O(n) space

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


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



Re: [algogeeks] c question!

2011-08-09 Thread rohit jangid
it will give error in line 3 because nodeptr is undefined till that point..

On Aug 9, 2011 8:03 PM, programming love love.for.programm...@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.



Re: [algogeeks] c question!

2011-08-09 Thread Rohit Srivastava
yep it will !!
any ways nodeptr is another name for pointer to the same structure so you
dont need to write structname *nodeptr
you can simply write nodeptr *p(say) to declare pointer to the structure

On Tue, Aug 9, 2011 at 8:09 PM, rohit jangid rohit.nsi...@gmail.com wrote:

 it will give error in line 3 because nodeptr is undefined till that point..

 On Aug 9, 2011 8:03 PM, programming love love.for.programm...@gmail.com
 wrote:

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


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



Re: [algogeeks] c question!

2011-08-09 Thread Rohit Srivastava
dont use *h just use h

On Tue, Aug 9, 2011 at 8:31 PM, siddharth srivastava akssps...@gmail.comwrote:

 Hi

 On 9 August 2011 20:26, programming love 
 love.for.programm...@gmail.comwrote:

   #includestdio.htypedef struct {char * a;
 }*nodeptr;
 main(){nodeptr *h;h-a=programming;printf(hi %s\n, h-a);}


 this gives an error. Please explain the concept behind this.



 You have used typedef incorrectly


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


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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-09 Thread rohit jangid
a new pointer type that can store the address of such structure

for example

nodeptr p;

will declare a pointer to that struct
but it is useless for me.
On Aug 9, 2011 8:19 PM, programming love love.for.programm...@gmail.com
wrote:
 @rohith, what if that statement is removed. Now, what will nodeptr stand
 for?

 On Tue, Aug 9, 2011 at 8:09 PM, rohit jangid rohit.nsi...@gmail.com
wrote:

 it will give error in line 3 because nodeptr is undefined till that
point..

 On Aug 9, 2011 8:03 PM, programming love 
love.for.programm...@gmail.com
 wrote:
 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


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


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



Re: [algogeeks] c question!

2011-08-09 Thread rohit jangid
when you declared  h it contains garbage address . h-a is meaningless .
read pointers chapter from K nd R for full details about pointers in C .
 On Aug 9, 2011 9:11 PM, programming love love.for.programm...@gmail.com
wrote:
 #includestdio.htypedef struct {char * a;
 }*nodeptr;
 main(){nodeptr h;h-a=programming;printf(hi %s\n, h-a);}

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


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

2011-08-08 Thread rohit
What will the following code snippet do, when is it passed the root of
a binary tree ?
func( Node *node){

  if(node-right != NULL)

   func( node-right);

  if(node-left != NULL)

func( node-left);

  if( node-left == NULL  node-right == NULL )

 delete(node);

}

Pick choice
Delete the tree from bottom to top

Delete the tree from top to bottom

Delete the leaf nodes from right to left

Delete the leaf nodes from left to right

I think it is 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.



Re: [algogeeks] Javascript

2011-08-08 Thread rohit jangid
javaScript's array are just like objects with some special properties
like length and push methods ( implemented in Array.prototype) . They
are efficient but their efficiency will be affected if you use them to
store huge data.
you can also say that since javascript's array's are basically not
arrays so they are significantly slower than the real arrays ( the
ones implemented in C/C++ for example)
but you can still use them, the actual performance may be different .

On Tue, Aug 9, 2011 at 2:46 AM, priyanshu priyanshuro...@gmail.com wrote:
 Is Javascript array efficient way to store thousands of values on
 client side??

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

2011-08-08 Thread rohit
 int get_power(int a, int b)
{
if(!b)
return 1;
if(b%2)
 return a * get_power(a, b/2);
 return get_power(a, b/2);
 }

int func(int p)
{ int sum = 0;
 for(int i = 1; i = p; ++i)
{
sum += get_power(i, 5);
}
return sum;

}

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

2011-08-08 Thread rohit jangid
ya that shouldn't pose any problem. But in case there is any performance
issue,you can always use php for that .

since every browser has its own js implementation so performance will vary
slightly due to that also, so test on different browsers.
On Aug 9, 2011 3:15 AM, Priyanshu priyanshuro...@gmail.com wrote:
 Well actually there are about 1000 values to be stored, but the value
itself
 is small(url of a website..).. i think it should not be a major
bottleneck..

 Thanks,
 Priyanshu

 On Mon, Aug 8, 2011 at 2:39 PM, rohit jangid rohit.nsi...@gmail.com
wrote:

 javaScript's array are just like objects with some special properties
 like length and push methods ( implemented in Array.prototype) . They
 are efficient but their efficiency will be affected if you use them to
 store huge data.
 you can also say that since javascript's array's are basically not
 arrays so they are significantly slower than the real arrays ( the
 ones implemented in C/C++ for example)
 but you can still use them, the actual performance may be different .

 On Tue, Aug 9, 2011 at 2:46 AM, priyanshu priyanshuro...@gmail.com
 wrote:
  Is Javascript array efficient way to store thousands of values on
  client side??
 
  --
  You received this message because you are subscribed to the Google
Groups
 Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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.



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

2011-08-06 Thread rohit
use a linked list to store child nodes, a tree node will hold pointer
to next sibling and a pointer to its first child.
typedef struct TreeNode{
struct TreeNode * nextSibling;
struct TreeNode * fistChild;
//rest things
}

On Aug 6, 4:10 pm, Aman Goyal aman.goya...@gmail.com wrote:
 Can anyone suggests a good data structure for n-ary tree.. where n is the
 input by the user...

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



Re: [algogeeks] Question

2011-08-05 Thread Rohit Srivastava
you might get error: floating pointing formats not linked!!
but thats obsolete! I don't compiler these days will give such an error
otherwise code written by Dipankar will solve ur problem if u r unable to
take multi-word input
On Fri, Aug 5, 2011 at 7:24 PM, Dipankar Patro dip10c...@gmail.com wrote:

 try doing this way and tell if the program is working properly now:
 for (i=0; i3; i++)
 {
  scanf(%[^\n], e[i].name);
  scanf(%f, e[i].sal);
 }

 There is always some problem in string input using %s, don't really know
 why though deeply.

 On 5 August 2011 17:48, Vijay Khandar vijaykhand...@gmail.com wrote:

 But program is not working properly...


 On Fri, Aug 5, 2011 at 5:44 PM, Nikhil Gupta 
 nikhilgupta2...@gmail.comwrote:

 Couldn't find any error.

 On Fri, Aug 5, 2011 at 5:38 PM, Vijay Khandar 
 vijaykhand...@gmail.comwrote:

 What errors are you likely to get when you run the following program?

 #includestdio.h
 #includeconio.h
 #includestring.h
 void main()
 {
 clrscr();
 struct emp
 {
 char name[20];
 float sal;
 };
 struct emp e[10];
 int i;
 for(i=0;i=3;i++)
 scanf(%s %f,e[i].name,e[i].sal);
 getch();
 }

 Plz Explain anyone.

 Vijay..

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




 --
 Nikhil Gupta
 Senior Co-ordinator, Publicity
 CSI, NSIT Students' Branch
 NSIT, New Delhi, 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.


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




 --

 ___

 Please do not print this e-mail until urgent requirement. Go Green!!
 Save Papers = Save Trees

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

2011-08-05 Thread Rohit Srivastava
which compiler are u using
?

On Fri, Aug 5, 2011 at 7:29 PM, Vijay Khandar vijaykhand...@gmail.comwrote:

 I include this fn linkfloat(), Now my program working properlybut
 why we have to include this fn externally plz explain.


 On Fri, Aug 5, 2011 at 6:07 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote:

 INCLUDE THIS FUNCTION
 linkfloat( )
 {
 float a = , *b ;
 b = a ;  /* cause emulator to be linked */
 a = *b ;/* suppress the warning - variable not used */
 };

 On Fri, Aug 5, 2011 at 6:04 PM, Vijay Khandar vijaykhand...@gmail.comwrote:

 But program is not giving the o/p.
 I have taken one printf statement same as scanf..and scanf() taking
 i/p but prinf() not giving o/p...


 On Fri, Aug 5, 2011 at 5:53 PM, Nikhil Gupta 
 nikhilgupta2...@gmail.comwrote:

 http://www.ideone.com/ZIibX

 The changes I have done in the program are to make it compatible to gcc
 compiler.
 Check the statement in the bottom of the page.

 On Fri, Aug 5, 2011 at 5:46 PM, Vijay Khandar 
 vijaykhand...@gmail.comwrote:

 What errors are you likely to get when you run the following program?

 #includestdio.h
 #includeconio.h
 #includestring.h
 void main()
 {
 clrscr();
 struct emp
 {
 char name[20];
 float sal;
 };
 struct emp e[10];
 int i;
 for(i=0;i=3;i++)
 scanf(%s %f,e[i].name,e[i].sal);
 getch();
 }

 A)floating point format not linked
 B)Suspicious pointer conversion
 C)Cannot use scanf() for structures
 D)Strings cannot be nested inside structures

 Plz Explain anyone.

 Vijay.

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




 --
 Nikhil Gupta
 Senior Co-ordinator, Publicity
 CSI, NSIT Students' Branch
 NSIT, New Delhi, 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.


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


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


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


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



Re: [algogeeks] Question

2011-08-05 Thread Rohit Srivastava
try using dev or any new 32bit compiler it wont give that error!!!
or try using this
void linkfloat(void)
{
 float a=0,*b=a;
 a=*b;
}
this code forces the emulator to be linked
On Fri, Aug 5, 2011 at 7:38 PM, Vijay Khandar vijaykhand...@gmail.comwrote:

 Yes correct,  In m using very old compiler Turbo C++


 On Fri, Aug 5, 2011 at 7:34 PM, Rohit Srivastava 
 access2ro...@gmail.comwrote:

 you might get error: floating pointing formats not linked!!
 but thats obsolete! I don't compiler these days will give such an error
 otherwise code written by Dipankar will solve ur problem if u r unable to
 take multi-word input
 On Fri, Aug 5, 2011 at 7:24 PM, Dipankar Patro dip10c...@gmail.comwrote:

 try doing this way and tell if the program is working properly now:
 for (i=0; i3; i++)
 {
  scanf(%[^\n], e[i].name);
  scanf(%f, e[i].sal);
 }

 There is always some problem in string input using %s, don't really know
 why though deeply.

 On 5 August 2011 17:48, Vijay Khandar vijaykhand...@gmail.com wrote:

 But program is not working properly...


 On Fri, Aug 5, 2011 at 5:44 PM, Nikhil Gupta nikhilgupta2...@gmail.com
  wrote:

 Couldn't find any error.

 On Fri, Aug 5, 2011 at 5:38 PM, Vijay Khandar vijaykhand...@gmail.com
  wrote:

 What errors are you likely to get when you run the following program?

 #includestdio.h
 #includeconio.h
 #includestring.h
 void main()
 {
 clrscr();
 struct emp
 {
 char name[20];
 float sal;
 };
 struct emp e[10];
 int i;
 for(i=0;i=3;i++)
 scanf(%s %f,e[i].name,e[i].sal);
 getch();
 }

 Plz Explain anyone.

 Vijay..

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




 --
 Nikhil Gupta
 Senior Co-ordinator, Publicity
 CSI, NSIT Students' Branch
 NSIT, New Delhi, 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.


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




 --

 ___

 Please do not print this e-mail until urgent requirement. Go Green!!
 Save Papers = Save Trees

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


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


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


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



Re: [algogeeks] merging of two sorted arrays

2011-08-04 Thread Rohit jalan
Consider two array a[] and b[].
Suppose Number of elements  in  a[] are n and number of elements in b[] are
m. a[] can accomodate m+n elements.

MergeInPlace(int a[], int b[],int n,int m)
{
   int i=n-1;
  int j=m-1;
  int k=n+m-1;
  while(i0  j0)
   {
 if(a[i]=b[j])
 a[k--]=a[i--]
 else
 a[k--]=b[j--]
}

while(j0)
 {
   a[k--]=b[j--]
 }
}


On Thu, Aug 4, 2011 at 10:46 PM, Kamakshii Aggarwal
kamakshi...@gmail.comwrote:


 how can  two sorted arrays be merged inplace?
 --
 Regards,
 Kamakshi
 kamakshi...@gmail.com

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




-- 
Regards :
ROHIT JALAN
B.E. Graduate,
Computer Science Department,
RVCE, Bangalore

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



  1   2   3   4   >