#pragma once
#ifndef ___HashRecord
#define ___HashRecord
// HashRecord.h : 해시 맵을 위한 keyed Record 클래스
#include <cstdio>
#include <string>
#include <cstring>
using namespace std;
#define KEY_SIZE 64 // 탐색키의 최대길이
#define VALUE_SIZE 64 // 탐색키와 관련된 정보
class Record {
char key[KEY_SIZE]; // 키 필드(사전의 경우 "단어")
char value[VALUE_SIZE]; // 키와 관련된 자료 ("의미")
public:
Record(const char* k = "", const char*v = "") { set(k, v); }
void set(const char* k, const char* v = "") {
strcpy_s(key, k);
strcpy_s(value, v);
}
void reset() { set("", ""); }
bool isEmpty() { return key[0] == '\0'; }
bool equal(const char* k) { return strcmp(k, key) == 0; }
string getKey(int i) { return key; }
string getValue(int i) { return value; }
void display() { printf("%20s = %s\n", key, value); }
};
#endif // !___HashRecord
'Programming > DS SorceCode' 카테고리의 다른 글
HashNode.h : 해시 맵을 위한 노드 클래스 (0) | 2019.04.06 |
---|---|
HashMap.h : 해싱을 이용하는 맵 클래스 #오류 있음 (0) | 2019.04.06 |
해싱 (0) | 2019.04.06 |
AVL 트리 (0) | 2019.04.05 |
Search.h : 다양한 탐색 함수를 포함함 헤더 (0) | 2019.04.04 |