File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Find biggest 2 numbers

 
kavitha vasu
Ranch Hand
Posts: 70
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3640
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kavitha, you got to read Collection API from Thinking In Java !!
[ March 03, 2008: Message edited by: Chetan Parekh ]
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 70
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic