• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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!)

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic