Professional Documents
Culture Documents
#include “Event.cpp”
#include “Heap.cpp”
#define PQMAX 30
class PriorityQueue
{
public:
PriorityQueue() {
heap = new Heap<Event>( PQMAX );
};
~PriorityQueue() {
delete heap;
};
Lecture No.33
Data Structure
Event* remove()
{
if( !heap->isEmpty() ) {
Event* e;
heap->deleteMin( e );
return e;
}
return (Event*)NULL;
cout << "remove - queue is empty." << endl;
};
Priority Queue Using Heap
int insert(Event* e)
{
if( !heap->isFull() ) {
heap->insert( e );
return 1;
}
cout << "insert queue is full." << endl;
return 0;
};
int full(void){
return heap->isFull();
};
Blob Coloring
A well-known low-level computer vision
problem for black and white images is the
following:
Blob Coloring
Thus in the following image, there are five
blobs.