aspose file tools*
The moose likes Beginning Java and the fly likes Question with an algorithm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Question with an algorithm" Watch "Question with an algorithm" New topic
Author

Question with an algorithm

Piggy Jing Piggy Jing
Greenhorn

Joined: Jan 04, 2006
Posts: 1
1) How to find 5 most frequent apprearance workds in a words array? what if the size of the array is so big that we only need ot find approximate 5 top popular words?
2) Assume speed is more important than storage. How do you count the number of bits that will set in 32 bit integer?

Please help. Thanks!
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Programming Diversions is for... diversions. Java Questions, (even ones that sound like homework) should be asked in the other forums.

I'll move it to the Java in General (beginner) forum for you.

Dave
Stuart Ash
Ranch Hand

Joined: Oct 07, 2005
Posts: 637
Originally posted by Piggy Jing Piggy Jing:
1) How to find 5 most frequent apprearance workds in a words array? what if the size of the array is so big that we only need ot find approximate 5 top popular words?
2) Assume speed is more important than storage. How do you count the number of bits that will set in 32 bit integer?

Please help. Thanks!


Piggy Jing Piggy Jing,

Welcome to the Ranch.

Perhaps StringUtils will help you get what you want. You might also want to browse thru the ArrayUtils class in the same package to see if it helps. Let us know if it did.


ASCII silly question, Get a silly ANSI.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

"Piggy Jing Piggy Jing,"

Welcome to JavaRanch!

Please revise your display name to meet the JavaRanch Naming Policy. To maintain the friendly atmosphere here at the ranch, we like folks to use real (or at least real-looking) names, with a first and a last name.

You can edit your name here.

Thank you for your prompt attention, and enjoy the ranch!

-Marc


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3716
    
    5

Are homework sets out all ready? I thought everyone was still on break.
[ January 05, 2006: Message edited by: Scott Selikoff ]

My Blog: Down Home Country Coding with Scott Selikoff
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Question with an algorithm