File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Find biggest 2 numbers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Find biggest 2 numbers" Watch "Find biggest 2 numbers" New topic
Author

Find biggest 2 numbers

kavitha vasu
Ranch Hand

Joined: Feb 22, 2007
Posts: 70
Hi friends,

Yesterday I have attended one interview , I got question like these,


3,4,5,67,1,67,233,466

How to find biggest of 2 numbers amoung these numbers .

Should not use any sorting algorithm
also they asked me to use any collection classes.
Also how to find duplicate of these numbers

Please any one help me to get solution for this.

Thanks
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Kavitha, you got to read Collection API from Thinking In Java !!
[ March 03, 2008: Message edited by: Chetan Parekh ]

My blood is tested +ve for Java.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

hi,

in collection class,TreeSet class is there,which avoid dupulicatevalue and also it will arrage the datas in ascending order..so last number is greatest number,and prvious one is 2nd greatest number

note:which class implements set interface always has the above properties

thanks & regards,

seetharaman
kavitha vasu
Ranch Hand

Joined: Feb 22, 2007
Posts: 70
Hi



Here i have to find the which is duplicate number and that should be printed on screen.

How to do that?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Find biggest 2 numbers
 
Similar Threads
Finding the maximum of an array without using a loop
compare three double numbers
URLBird find by Hotel or Name
regarding xml parsing and retrieve the maximum and minimum values from that parse
validation problem for cost : struts2