Files
CSCI-1200/labs/priority_queues/priority_queue.h
Jidong Xiao 53824b1147 adding lab
2025-04-09 12:19:36 -04:00

69 lines
1.1 KiB
C++

#ifndef priority_queue_h_
#define priority_queue_h_
#include <iostream>
#include <vector>
#include <cassert>
template <class T>
class priority_queue {
private:
std::vector<T> m_heap;
public:
priority_queue() {}
priority_queue( std::vector<T> const& values )
{
}
const T& top() const
{
assert( !m_heap.empty() );
return m_heap[0];
}
void push( const T& entry )
{
}
void pop()
{
assert( !m_heap.empty() );
}
int size() { return m_heap.size(); }
bool empty() { return m_heap.empty(); }
// The following three functions are used for debugging.
// Check to see that internally the heap property is realized.
bool check_heap( )
{
return this->check_heap( this->m_heap );
}
// Check an external vector to see that the heap property is realized.
bool check_heap( const std::vector<T>& heap )
{
}
// A utility to print the contents of the heap. Use it for debugging.
void print_heap( std::ostream & ostr )
{
for ( unsigned int i=0; i<m_heap.size(); ++i )
ostr << i << ": " << m_heap[i] << std::endl;
}
};
template <class T>
void heap_sort( std::vector<T> & v )
{
}
#endif