• Post Reply Bookmark Topic Watch Topic
  • New Topic

The smallest stack  RSS feed

 
Vlada Den
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to write a method that finds the smallest stack in the array of stacks, but I cannot figure it out myself. Maybe someone could give me an example?

Thanks,

Vlada
 
Dave Wingate
Ranch Hand
Posts: 262
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What methods do your "stacks" support? Does a stack have a size() method? If so, then your problem is reduced to a search problem -- i.e. how to find the smallest number in an array.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!