[algogeeks] someone pls explain the o/p??

2012-01-29 Thread Ashish Sachdeva
http://ideone.com/Ily5v

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

2012-01-29 Thread Piyush Kapoor
xy is a mixed expression involving two operands of different types,one of
unsigned int and other signed int.Since implicit type conversion takes
place in such cases,the signed int is converted to unsigned int ,which
means that
 -2(signed) is converted to

4294967294 (unsigned) .,and then the comparison takes place.

http://ideone.com/VAyV5

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

2012-01-29 Thread Saurabh Yadav
may be because when you compare unsigned number with signed number ,the
signed will changed to unsigned type and when signed will changed to
unsigned type, it's MSB is one ,so  y will be greater than x

i am not sure about the reason i gave !!

On Sun, Jan 29, 2012 at 2:25 PM, Ashish Sachdeva ashish.asachd...@gmail.com
 wrote:

 http://ideone.com/Ily5v

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




-- 
Thanks  Regards
Saurabh Yadav

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] [Combinatorics] count possible number of binary search trees, given number of nodes

2012-01-29 Thread Moheed Moheed Ahmad
I know how to solve it programatically, can anybody pls help me to solve it
using combinatorics.
-Moheed

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

2012-01-29 Thread Moheed Moheed Ahmad
A typical implementation of quick sort works on quick sorting subarray and
comparison is
done in a linear manner that is a[i] is compared with pivot and then a[i+1]
and so on. Virtual memory systems employ some sort of caching. Caching
works on the principle of spatial locality of reference. That said, once a
comparison begins, after a miss in the cache, cache is fetched for the
miss(a[i]) as well as for next few more memory cells (a[i+1], a[i+2], etc).
This ensures that next 'few'(typically 3-5) iteration of the loop will be a
cache hit, there by speeding up the algorithm.


-Moheed
I am who I am, no matter where I am or who I am with.
*
*



On Sun, Jan 29, 2012 at 12:38 AM, karthikeya s karthikeya.a...@gmail.comwrote:

 How QuickSort is good in Virtual Memory Enviroment ?

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

2012-01-29 Thread Firoz Khursheed
http://ideone.com/5uhz1
it seems that
-ve number is always converted to unsigned, but this time x=3  is greater
why?


On Sun, Jan 29, 2012 at 3:14 PM, Saurabh Yadav saurabh...@gmail.com wrote:

 may be because when you compare unsigned number with signed number ,the
 signed will changed to unsigned type and when signed will changed to
 unsigned type, it's MSB is one ,so  y will be greater than x

 i am not sure about the reason i gave !!


 On Sun, Jan 29, 2012 at 2:25 PM, Ashish Sachdeva 
 ashish.asachd...@gmail.com wrote:

 http://ideone.com/Ily5v

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




 --
 Thanks  Regards
 Saurabh Yadav

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

2012-01-29 Thread saurabh singh
I once answered a similar question in stackoverflow.com
http://stackoverflow.com/questions/8586722/comparing-unsigned-char-and-eof/8586867#8586867
Hope
it helps...
Saurabh Singh
B.Tech (Computer Science)
MNNIT
blog:geekinessthecoolway.blogspot.com



On Sun, Jan 29, 2012 at 6:54 PM, Firoz Khursheed
firozkhursh...@gmail.comwrote:

 http://ideone.com/5uhz1
 it seems that
 -ve number is always converted to unsigned, but this time x=3  is greater
 why?


 On Sun, Jan 29, 2012 at 3:14 PM, Saurabh Yadav saurabh...@gmail.comwrote:

 may be because when you compare unsigned number with signed number ,the
 signed will changed to unsigned type and when signed will changed to
 unsigned type, it's MSB is one ,so  y will be greater than x

 i am not sure about the reason i gave !!


 On Sun, Jan 29, 2012 at 2:25 PM, Ashish Sachdeva 
 ashish.asachd...@gmail.com wrote:

 http://ideone.com/Ily5v

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




 --
 Thanks  Regards
 Saurabh Yadav

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

2012-01-29 Thread Firoz Khursheed
@saurab...@gmail.com
go it.
 +1

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

2012-01-29 Thread Zyro
Write a function that takes an integer and returns a char array that
contains the -2 (minus 2) base representation of the given integer.
Example:
Input Output
7 11011
3 111
2 110

Plzzz  help  ???

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

2012-01-29 Thread Anika Jain
I didnt get the idea of minus 2, coz wen base is 2, we use digits 0 and 1,
if its base , then digits from 0 to 7 and so on.. so for base -2, which
digits go?


On Sun, Jan 29, 2012 at 11:26 PM, Zyro vivkum...@gmail.com wrote:

 Write a function that takes an integer and returns a char array that
 contains the -2 (minus 2) base representation of the given integer.
 Example:
 Input Output
 7 11011
 3 111
 2 110

 Plzzz  help  ???

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

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Represent a number in base of minus 2 ????

2012-01-29 Thread Zyro
@Anika

7 = 1*((-2)^4) + 1*((-2)^3) + 0*((-2)^2) + 1*((-2)^1) + 1*((-2)^0) ...

simlilary for other numbers...


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

2012-01-29 Thread radha krishnan
Hi Coderz,
We would like to invite you all to participate in Kurukshetra OPC 2012
http://www.spoj.pl/KOPC12(An Individual Contest ), a 4-hour acm-icpc
style online programming competition, which is organized as a part
ofKurukshetrahttp://www.kurukshetra.org.in2012 , the Technical fest
of College Of Engineering Guindy, Anna
University,India.
You can look at our past contests here
Kurukshetra OPC 2009 http://www.spoj.pl/KOPC09/ranks/ Kurukshetra
OPC 2010http://www.spoj.pl/KOPC10/ranks/
*Contest Page:* http://www.spoj.pl/KOPC12/

*Contact:* radhakrishnance...@gmail.com
*
*
*Problems :* 6-7 problems with mix of easy (2), medium (3) and hard (1-2)
levels.
*
*
*Prize Money in INR *
First Place: 15000 INR
II place  :   5000 INR
III place :   3000 INR

Please ignore this if you came to know about this contest by other means
.Sorry for that .
Regards,
Kurukshetra Team 2012,
CEG,Anna University,
Chennai, 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: Represent a number in base of minus 2 ????

2012-01-29 Thread saurabh singh
Use a pen and paper:) Generate a few numbers in base -2 by hand.You
will get the logic.
Saurabh Singh
B.Tech (Computer Science)
MNNIT
blog:geekinessthecoolway.blogspot.com



On Sun, Jan 29, 2012 at 11:44 PM, Zyro vivkum...@gmail.com wrote:

 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.



[algogeeks] Spoj_problem:INUMBER

2012-01-29 Thread Anshul AGARWAL
hi friends,
i m not able to find any logic to solve this problem.
Can any one suggest me good algorithm of spoj_problem:
(INUMBERhttp://www.spoj.pl/problems/INUMBER/
).
thanx in advance

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



[algogeeks] Find all longest increasing subsequence of length k

2012-01-29 Thread atul anand
Hi,

suggest an algo which will find all longest increasing sub
sequence of length K.

for eg:-
input : 7 8 9 4 10 11
K=3

output :
7 8 9
7 9 10
7 10 11
8 9 10
8 10 11

desired complexity : O(k*n*logn)

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

2012-01-29 Thread Rujin Cao
Is the correct output   7 2 1 5 ?

Did you intend to print the leaf node ?

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

2012-01-29 Thread Mihir Kulkarni
I only intend to print the root to leaf paths. The correct output should be:
721
725
It works fine when I use array instead of LinkedList.

cheers,
Mihir Kulkarni
Graduate Student
University of California, Irvine
http://goo.gl/CvRcG



On Sun, Jan 29, 2012 at 10:06 PM, Rujin Cao drizzle...@gmail.com wrote:

 Is the correct output   7 2 1 5 ?

 Did you intend to print the leaf node ?

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

2012-01-29 Thread Manee
store all the indices wherever the value decreases. all subsequences
between 0, these indices and the end index n are increasing
subsequences.

Check which of these are of length K.



On Jan 26, 11:17 pm, atul anand atul.87fri...@gmail.com wrote:
 Hi,

 suggest an algo which will find all longest increasing sub
 sequence of length K.

 for eg:-
 input : 7 8 9 4 10 11
 K=3

 output :
 7 8 9
 7 9 10
 7 10 11
 8 9 10
 8 10 11

 desired complexity : O(k*n*logn)

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

2012-01-29 Thread atul anand
@Mihir : actually you are using linked listso you are keep on adding
the nodes but not removing it..hence...you are getting wrong output..

i guess this should be done to fix the code.

public static void paths(Node node, LinkedListInteger list) {
   if(node == null) return;
   list.add(node.data);

   if(node.left == null  node.right == null) {
  print(list);
   }
   else {
  paths(node.left, list);

*  removeLastNodefromLinkedList();*
  paths(node.right, list);

   *   removeLastNodefromLinkedList();*

   }

r*emoveLastNodefromLinkedList();*

}

public static void print(LinkedListInteger list) {
   System.out.println(Contents of list:  + list);
}



On Mon, Jan 30, 2012 at 11:41 AM, Mihir Kulkarni mihirk...@gmail.comwrote:

 I only intend to print the root to leaf paths. The correct output should
 be:
 721
 725
 It works fine when I use array instead of LinkedList.

 cheers,
 Mihir Kulkarni
 Graduate Student
 University of California, Irvine
 http://goo.gl/CvRcG



 On Sun, Jan 29, 2012 at 10:06 PM, Rujin Cao drizzle...@gmail.com wrote:

 Is the correct output   7 2 1 5 ?

 Did you intend to print the leaf node ?

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

2012-01-29 Thread Rahul Kumar
ur subject is decimal to binary but in content u have written float to
decimal... I don't get it

On Sat, Jan 28, 2012 at 11:49 PM, rahul sharma rahul23111...@gmail.comwrote:

 it should be able to convert not only int but also float like 190.345 to
 decimalcan ny one suggest thnx in advance

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

2012-01-29 Thread Manni mbd
@Manee: can u explain a bit more !! still unclear

On 1/30/12, Manee mani.ma...@gmail.com wrote:
 store all the indices wherever the value decreases. all subsequences
 between 0, these indices and the end index n are increasing
 subsequences.

 Check which of these are of length K.



 On Jan 26, 11:17 pm, atul anand atul.87fri...@gmail.com wrote:
 Hi,

 suggest an algo which will find all longest increasing sub
 sequence of length K.

 for eg:-
 input : 7 8 9 4 10 11
 K=3

 output :
 7 8 9
 7 9 10
 7 10 11
 8 9 10
 8 10 11

 desired complexity : O(k*n*logn)

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