Re: [algogeeks] Re: How random numbers are generated?

2011-12-05 Thread tarun kumar
actually there are no random numbers, they are always "psuedo random". the
criteria can be anything to generate. one is to take the current time.
At any moment, time can't be same hence the numerical value of "current
time" provides a great help in that direction.

although to generate random numbers  mean, variance are also taken into
account.rand() function  is not a good random number generator function. it
generates the same list every time you call main().you have to do some
manipulations to look like random.

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

2011-09-04 Thread tarun kumar
answer 2.

1. start from root.
2. mark it current.
3. save it in temp1 and current->next in temp2;
4. go to (current->next)->next;
5. now make temp2 point to temp1.
6. repeat till the linked list is not fully traversed
7.* make some restriction for first and last node;*
8. the linked list is now reversed.

Time complexit O(n).

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

2011-09-04 Thread tarun kumar
the problem can be solved in O(n) time without using extra space .using the
algorithm of "finding the subarray of maximum sum in a given array."(time
complexity is O(n) and no extra space).
here you just have to stop when you find sum equal to k.

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



Re: [algogeeks] puzzle

2011-09-04 Thread tarun kumar
can we open the door twice(with the condition that once the door is opened
switch can't be manipulated).? if not ,It is riddle rather an algorithmic
question and the above written answer seems to be 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.