• Post Reply Bookmark Topic Watch Topic
  • New Topic

DataStructure for getting the maximum element in int array  RSS feed

 
sreenath reddy
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have an int array which is of size 1000 and the values inside that can be duplicated (mean same value can be present in many places) ...........now given this array i want to array which gives me the positions of the greatest(maximum) element in this array

For eg array is : [ 10,20,1,200, 19, 200, 10 ,19,200]

given the above array i need an array which gives me [ 3,5,8] . These are the positions of the maximum element (200) in the given array

How can i achieve this with greater efficiency ?? can any one let me know
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This sounds a lot like a homework assignment. We're not big fans of doing people's work for them -- but we're more than happy to help you help yourself.

So.... how do you think is the best way to solve this problem? How would you code it? Why do you think your idea may not be the most efficient?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!