implementation of priority queues

Newbie Member
hi,
I am siya.....i have a query regarding priority queues.......how can priority queues be implemented such that the operations of priority queue,that is Insert and ExtractMax be done in constant time....Using priority queues with heaps takes log n time to implement these opearitons........what data structure helps to implement these in O(1) time....

Thanks in advance....
siya.
Go4Expert Founder
Searching the forum would give you nice code for the same.
Ambitious contributor
I don't see how both Insert and ExtractMax can be O(1). Obviously Insert can be O(1) if you just append new elements to the end of a vector, but then ExtractMax would be O(n) since you'd have to search the entire vector. You may be able to take advantage of special properties of your key, but in general you won't be able to get both operations below sqrt(log n) or maybe log log n.
{"cc_re__cc_re__cc_by_sa_3_0_en": ["   <a href=\"http://www.go4expert.com/sitemap/\">Sitemap</a> -\r\n            <a href=\"http://www.go4expert.com/advertise.php\" rel=\"nofollow\">Advertise</a> - \r\n            <a href=\"http://www.go4expert.com/privacy.php\" rel=\"nofollow\">Privacy Statement</a> -\r\n            <a href=\"#top\" rel=\"nofollow\" onclick=\"self.scrollTo(0, 0); return false;\">Top</a>\r\n\r\n<div align=\"center\">\r\n\r\n\t<div class=\"smallfont\" align=\"center\">\r\n\t\r\n\r\n\t\r\n\r\n\t<div class=\"copyright\" align=\"center\">User Contribution Licensed Under <a rel=\"license\" href=\"http://creativecommons.org/licenses/by-sa/3.0/deed.en_US\">Creative Commons with Attribution Required</a>. Site Design and Logo Copyright  Go4Expert 2004 - 2013. </div>\r\n\r\n\t</div>\r\n</div>\r\n\r\n        </div>\r\n    </div>\r\n</div>\r\n\r\n\r\n<!-- /content area table -->\r\n\r\n\r\n<script type=\"text/javascript\">\r\n<!--\r\n\tvBulletin_init(); responsiveNav(\"#nav\");\r\n//-->\r\n</script>\r\n<script type=\"text/javascript\" src=\"http://i1.g4estatic.com/cssjs/g4efads-10.js\"></script>\r\n<script type=\"text/javascript\">\r\n(function(){\r\n  function trackPageLoadTimeGA() {\r\n    var _endpt=(n"], "copyright__copyright__copyright": ["advance....\nsiya.\nGo4Expert Founder\nSearching the forum would give you nice code for the same.\nAmbitious contributor\nI don't see how both Insert and ExtractMax can be O(1). Obviously Insert can be O(1) if you just append new elements to the end of a vector, but then ExtractMax would be O(n) since you'd have to search the entire vector. You may be able to take advantage of special properties of your key, but in general you won't be able to get both operations below sqrt(log n) or maybe log log n.", "advance....\nsiya.\nGo4Expert Founder\nSearching the forum would give you nice code for the same.\nAmbitious contributor\nI don't see how both Insert and ExtractMax can be O(1). Obviously Insert can be O(1) if you just append new elements to the end of a vector, but then ExtractMax would be O(n) since you'd have to search the entire vector. You may be able to take advantage of special properties of your key, but in general you won't be able to get both operations below sqrt(log n) or maybe log log n."]}