Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Question with an algorithm

 
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!
 
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
 
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.
 
Sheriff
Posts: 11343
Mac Safari Java
  • 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
 
author
Posts: 4112
28
Google Web Toolkit Eclipse IDE Flex
  • 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 ]
 
The happiness of your life depends upon the quality of your thoughts -Marcus Aurelius ... think about this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!