• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

difference between [--nItems] and [nItems-1]??

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the priority queue,
i dont understand these two methods....

they are the opposite of what should be done,, i think they give the maximum but in the data structures book it says the following

to remove the minimum:


and the other method is to peek on the minimum in the PRIORITY QUEUE:


this way, its gonna peek on the maximum --------> this is what i think

but the right thing is that it peeks on the minimum without changing anything this is from the book and my lectures so its correct but i just dont get it soo please help???

 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The difference between the two methods you posted is this:

In the first version, you are decrementing the variable nItems. So the value of the variable nItems is changed.
In the second version, you are not changing the value of the variable nItems.
 
Nadine Ernest
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
aha...thank youuuu soo much!!

i totally misunderstood the whole thing,,,i read it upside down! (silly me!)

reply
    Bookmark Topic Watch Topic
  • New Topic