• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question with an algorithm

 
Piggy Jing Piggy Jing
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
 
Scott Selikoff
author
Saloon Keeper
Posts: 4020
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are homework sets out all ready? I thought everyone was still on break.
[ January 05, 2006: Message edited by: Scott Selikoff ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic