aspose file tools*
The moose likes Beginning Java and the fly likes some difficult questions! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "some difficult questions!" Watch "some difficult questions!" New topic
Author

some difficult questions!

liu hao
Greenhorn

Joined: Oct 02, 2009
Posts: 9
1, To decide whether there are any duplicate values in an array (of over 100 entries), we do not need to first sort the array. TRUE or FALSE?

2,To find the 5th largest element in an array (of over 100 entries), we do not need to first sort the array. TRUE or FALSE?

3,To output both the largest and the smallest elements in an array (of over 100 entries), we must first sort the array. TRUE or FALSE?
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 3947
    
  17

Well, those are some pretty good questions. What do you think the answers are? Why?

You shouldn't expect us to give you the answers to these types of questions, we generally expect you to ShowSomeEffort, which in this case would be provide what you think the answers are and some justification. If you can not decide on an answer let us know exactly where you are hung up so we can help clear your mind.


Steve
Ireneusz Kordal
Ranch Hand

Joined: Jun 21, 2008
Posts: 423
[Answers deleted: please don't provide straight answers.]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19541
    
  16

Ireneusz Kordal wrote:1. TRUE
2. TRUE
3. FALSE

What did Steve say about not giving out the answers like that? It's a good thing you didn't provide any motivations for your answers...


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
liu hao
Greenhorn

Joined: Oct 02, 2009
Posts: 9
Steve Luke wrote:Well, those are some pretty good questions. What do you think the answers are? Why?

You shouldn't expect us to give you the answers to these types of questions, we generally expect you to ShowSomeEffort, which in this case would be provide what you think the answers are and some justification. If you can not decide on an answer let us know exactly where you are hung up so we can help clear your mind.


I just have no idea about the question. I know if sorting the array, we'll find a duplicate value;we'll do all the task. but if it is necessary i know not. and anyone can explain why nswers. lot of thanks
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19541
    
  16

Ask yourself this: can you find a way, any way, to do it without sorting the array first? It will be easier and more efficient if the array is sorted, but that's not the question.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: some difficult questions!
 
Similar Threads
arrays?
Sort text in select
How would i break this down into seperate metods?
2-D array of boolean
compareTo()