-
Notifications
You must be signed in to change notification settings - Fork 0
/
vertex.h
63 lines (59 loc) · 1.09 KB
/
vertex.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#pragma once
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include "i_meldable_heap.h"
namespace MHeap
{
class BVertex : public IVertex
{
public:
int key;
BVertex * left, *right;
unsigned int rang;
BVertex();
~BVertex(){};
explicit BVertex(int);
BVertex(int, unsigned int, BVertex*, BVertex*, BVertex*);
virtual bool operator<(const BVertex&);
};
class SVertex : public IVertex
{
public:
int key;
SVertex * left, *right;
~SVertex(){};
SVertex();
explicit SVertex(int k);
virtual bool operator<(SVertex *);
void update_rang(){};
virtual void swap_children();
virtual void update();
bool bad_leftist_vertex()
{
return false;
}
HeapType get_heap_type()
{
return HeapType::SKEW;
}
};
class LVertex : public SVertex
{
unsigned int rang;
public:
LVertex * left, *right;
LVertex();
~LVertex(){};
explicit LVertex(int);
virtual void update_rang();
virtual bool bad_leftist_vertex();
virtual void swap_children();
virtual void update();
HeapType get_heap_type()
{
return HeapType::LEFTIST;
}
};
}