Re: [algogeeks] Re: find the number.

2010-12-12 Thread shoban babu
@Dave :but it will take more time. any other solution O(n^2).?

On Sat, Dec 11, 2010 at 7:48 PM, Dave dave_and_da...@juno.com wrote:

 @Naresh: The sequence of numbers generated by this rule for any given
 starting number is called a Collatz Sequence. Try googling it.

 Here is a list of the number of iterations required for n between 1
 and 10,000: http://oeis.org/A006577/b006577.txt. Maybe that will help.

 Dave

 On Dec 11, 7:20 am, Naresh A suryanar...@gmail.com wrote:
  Given range of numbers between A and B (A= B)
  Find the number within given range which has more number of iterations as
  per the following
 
   n { stop ; return iteration number }  if n=1;
   n = 3n+1  if n is odd
   n =  n/2  if n is even
 
  for eg :
 
  n=3 odd
  
  n=10;
  n=5;
  n=16;
  n=8;
  n=4;
  n=2;
  n=1;
 
  iterations : 7
 
  --
  *
  Time complexity= (n^2)
 
  *
  *NARESH ,A*
  **

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




-- 
Shoban babu.B
M.E.,CSA,
IISc.

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

2010-10-06 Thread shoban babu
In a linked list how to insert an element at 3rd position given a pointer to
4th position.

-- 
Shoban babu.B
M.E.,CSA,
IISc.

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

2010-10-06 Thread shoban babu
@Rahul
the only one pointer is there and it is pointing to the 4th node only,, and
we don't know where the head is points to...

On Wed, Oct 6, 2010 at 11:20 PM, RAHUL KUJUR kujurismonu2...@gmail.comwrote:

 Take two pointers p and q. Initially p points to head.


 while(p!=given pointer)
 {
 p=p-link;
 q=p;
 };

 Now you hv pointer at 3rd and 4th position. Now insertion is simpleHope
 this will work


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




-- 
Shoban babu.B
M.E.,CSA,
IISc.

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