Re: [algogeeks] size of array

2013-01-30 Thread Piyush

sizeof(array)/sizeof(array[0])

On 28-Jan-13 3:44 PM, Anil Sharma wrote:



  How to calculate the size/lenght of an int array which is
  passed as an ONLY argument to a function???

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




Re: [algogeeks]

2013-01-30 Thread Shamil
After shuffling order can be same as previous order. It is quite natural. 
As you said you can shuffle again if you don't want that case. 

On Wednesday, January 30, 2013 10:16:57 AM UTC+4, shady wrote:

 Yes I agree to it, it won't be random... but suppose I don't want a case 
 when all elements are at their own position because that case means 
 that they are not shuffled. Perhaps we can run the algorithm again, since 
 the probability of same event occurring two times in a row will be very 
 less.

 On Tue, Jan 29, 2013 at 12:13 AM, Carl Barton 
 odysseus...@gmail.comjavascript:
  wrote:

 Because then it's not a random shuffle? If you randomly shuffle something 
 the order you currently have should be just as likely as any other


 On 28 January 2013 12:29, shady sin...@gmail.com javascript: wrote:

 Why do we use Fisher Yates 
 algorithmhttp://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm
  when 
 in the worst case there is no shuffle at all ?
 we can modify it by generating random number not inclusive of the 
 element that we are about to swap

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

 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.




Re: [algogeeks] size of array

2013-01-30 Thread Prem Krishna Chettri
@Piyush .. Never works..

  @All  there is no way to do the given requirement in pure C.

On Wed, Jan 30, 2013 at 1:45 PM, Piyush piyush.to...@gmail.com wrote:

  sizeof(array)/sizeof(array[0])


 On 28-Jan-13 3:44 PM, Anil Sharma wrote:

  How to calculate the size/lenght of an int array which is passed as an
 ONLY argument to a function??? --
 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.




-- 
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] size of array

2013-01-30 Thread Nishant Pandey
i already said this is not possible , in my intial draft , as we dont have
any information of memory owner in called function , just have base address
which is address of single element of the array .


On Wed, Jan 30, 2013 at 1:55 PM, Prem Krishna Chettri hprem...@gmail.comwrote:

 @Piyush .. Never works..

   @All  there is no way to do the given requirement in pure C.


 On Wed, Jan 30, 2013 at 1:45 PM, Piyush piyush.to...@gmail.com wrote:

  sizeof(array)/sizeof(array[0])


 On 28-Jan-13 3:44 PM, Anil Sharma wrote:

  How to calculate the size/lenght of an int array which is passed as an
 ONLY argument to a function??? --
 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.




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




Re: [algogeeks] Puzzle.. How to solve??

2013-01-30 Thread nikhil rao
Thanks Varun :)

On Wednesday, 30 January 2013 11:21:35 UTC+5:30, varun pahwa wrote:

 Hi,
 Look at team Team7. F2,F9,F12,F14,F15.
 = F12 - Chelsa.
 C - 7,12
 L - 2,9
 and 14,15 not from liverpool.
 Now, look at Team 6.
 So,
 C - 7,12
 L - 3,6,2,9
 U - 15 , 1 (From Team 1)
 Team 2 - 11  13 not from liverpool.
 Team 3 - 11  5 not from liverpool
 Team 5 = 11 from C
 So,
 C - 7,12,11,10 (From Team 4),14 (From Team 7)
 L - 3,6,2,9,4(From Team 5),16 (From Team 5), 8 (From Team 8) 
 U - 15 , 1 , 5 (From Team 3), 13 (From Team 8)

 Rewriting it.
 L - 2,3,4,6,8,9,16
 C - 7,10,11,12,14
 U - 1,5,13,15


 Now, all the questions can be answered.
 Hope I'm cleared.

 Thanks  Regards,
 Varun


  


 On Tue, Jan 29, 2013 at 12:25 AM, nikhil rao nikhi...@gmail.comjavascript:
  wrote:

 Dream teams are formed by television viewers by selecting five players 
 from the sixteen players namely 
 F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13,F14,F15 and F16.The players 
 belong to exactly one of the three teams namely Chelsea,Liverpool and 
 United.Every Dream Team must have two players each from Chelsea and 
 Liverpool and one player from united.Following information is provided

 a)F12 is not from United
 b)F7 is from Chesla.
 c)F2 and F9 are from liverpool
 d)the 'match fee' of each player belonging to chesla ,liverpool, and 
 united is Euro 800.Euro775 and euro 725 match played respectively.

 8 such dearm teams were formed are mentioned below...
 team1=F3,F9,F7,F1,F12
 Team2=F12,F11,F13,F6,F9
 Team3=F6,F3,F5,F11,F7
 Team4=F2,F10,F7,F6,F1
 Team5=F1,F4,F16,F11,F10
 Team6=F6,F3,F7,F15,F12
 Team7=F2,F9,F12,F14,F15
 Team8=F4,F8,F13,F11,F10

Q1)in dream team 6 name the united player?
 1)F3 2)F6 3)F12 4)F15
   
 Q2)how many players belong to Chesla from the given sixteen   players?
 1)4 2)5 3) 6 4)7

   Q3)In team 8 who are from liverpool?
 a)F4,F8
 b)F10,F11
 c)F11,F13
 d)F4,F11

  Q4)what is the total fees per match (in Euros) for team ?
 1)3875
 2)3825
 3)3800
 4)none of these

   Q5)which of the following combinations have only Liverpool players?
 a)F13,F3
 b)F3,F16
 c)F16,F14
 d)F14,F2

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




 -- 
 Varun
 Product Engineer,
 Vizury
  
 People who fail to plan are those who plan to fail.
  

-- 
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] Puzzle.. How to solve??

2013-01-30 Thread nikhil rao
Ya your rite Anmol . 4th was wrong i guess.. incomplete question.

On Tuesday, 29 January 2013 12:58:07 UTC+5:30, Anmol Dhar wrote:

 Answer:
 1)- (4)
 2)-- (2)
 3)--- (a)
 4) doubt, for which team match fees you are asking?
 5) (b)
 Correct me if i'm wrong..please don't reply with  answers if i'm 
 incorrect... wanna give one more shot! ;)


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




[algogeeks] Re: Generating mazes

2013-01-30 Thread Don
It is George Marsaglia's multiply with carry pseudo-random number
generator. It has a period of 2^32, which is long enough for this
purpose. It is about as good as a 32-bit rng can be. In real life I
use the Mersenne Twister, but I wanted something simple to include
here.

Don

On Jan 29, 11:46 pm, Piyush Grover piyush4u.iit...@gmail.com wrote:
 @Don can you give the logic of your rnd() function?

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




[algogeeks] Re: GATE-2011 Question

2013-01-30 Thread Don
You have to identify the bottleneck in the pipeline. The time required
for the bottleneck is the steady state time per operation of the
pipelined processing. Then determine the time to do the 4 stages
sequentially. The difference is the speed up.

Don

On Jan 30, 11:59 am, Ayush Kapoor ayush21011...@gmail.com wrote:
 Consider an instruction pipeline with four stages (S1, S2, S3 and S4) each
 with combinational circuit only. The pipeline registers are required
 between each stage and at the end of the last stage. Delays for the stages
 and for the pipeline registers are as given in the figure.

 What is the approximate speed up of the pipeline in steady state under
 ideal conditions when compared to the corresponding non-pipeline
 implementation? [2 marks]
 (A) 4.0
 (B) 2.5
 (C) 1.1
 (D) 3.0

  Answer to this question is 2.5
 Can anybody explain me how to solve this question?

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




[algogeeks] Re: size of array

2013-01-30 Thread Don
There is not a sure way to do that in C or C++ without putting an
additional requirement on the caller.

Don

On Jan 28, 5:14 am, Anil Sharma anilsharmau...@gmail.com wrote:
 How to calculate the size/lenght of an int array which is passed as an ONLY
 argument to a function???

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