Binary heap file C ++

Source: Internet
Author: User

I have been writing this thing for a long time. I wrote the prim algorithm yesterday. STL won't write binary heap yet. It's sad. It will be learned in the future. now, use this one first.

Post: I don't want to talk about it anymore. Liu Xiang is about to start. Let's take a look at his.

// Binaryheap. H -- 2011-08-28-22.57 // purpose: // define a class "binaryheap ". // declare methods of the class, and define element member. # include <iostream> class binaryheap {public: typedef struct node {int startindex; int endindex; int weight;} node; private: node * m_heap; int m_size; int m_currentsize; void m_percolateup (INT index); void m_percolatedown (INT index); Public: binaryheap (INT size = 0 );~ Binaryheap (void); bool isempty (void); bool isfull (void); bool insert (INT startindex, int endindex, int weight ); bool deletemin (node * const pnode );};

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.