분류 | 게시판 |
베스트 |
|
유머 |
|
이야기 |
|
이슈 |
|
생활 |
|
취미 |
|
학술 |
|
방송연예 |
|
방송프로그램 |
|
디지털 |
|
스포츠 |
|
야구팀 |
|
게임1 |
|
게임2 |
|
기타 |
|
운영 |
|
임시게시판 |
|
옵션 |
|
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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | // Entry.h #include <iostream> using namespace std; template <typename K, typename V> class Entry { public: typedef K Key; typedef V Value; public: Entry(const K& k= K(), const V& v=V()) :_key(k), _value(v) {} K& key() { return _key; } V& value() { return _value; } void setKey(const K& k) { _key = k; } void setValue(const V& v) { _value = v; } private: K _key; V _value; }; //LinkedBinaryTree.h #include <list> #include "Entry.h" typedef int Elem; class LinkedBinaryTree { public: struct Node { Entry<Elem, Elem> E; Node* par; Node* left; Node* right; Node() : par(NULL), left(NULL), right(NULL) {} }; public: class Position { private: Node* v; public: Position(Node* _v=NULL) : v(_v) {} Elem& operator*() { return v->E.value(); } Position left() const { return Position(v->left); } Position right() const { return Position(v->right); } Position parent() const { return Position(v->par); } bool isRoot() const { return v->par == NULL; } bool isExternal() const { return v->left == NULL && v->right == NULL; } bool isInternal() const { return v->left != NULL || v->right != NULL; } //추가 friend class LinkedBinaryTree; }; typedef std::list<Position> PositionList; public: LinkedBinaryTree(); int size() const; bool empty() const; Position root() const; PositionList positions() const; void addRoot(); void expandExternal(const Position& p); Position removeAboveExternal(const Position& p); protected: void preorder(Node* v, PositionList& pl) const; private: Node* _root; int n; }; //SearchTree.h #include "LinkedBinaryTree.h" template <typename E> class SearchTree { public: typedef typename E::Key K; typedef typename E::Value V; class Iterator; public: SearchTree(); int size(); bool empty() const; Iterator find(const K& k); Iterator insert(const K& k, const V& x); void erase(const K& k); void erase(const Iterator& p); Iterator begin(); Iterator end(); protected: //typedef LinkedBinaryTree<E> BinaryTree; typedef typename LinkedBinaryTree::Position TPos; TPos root() const; TPos finder(const K& k, const TPos& v); TPos inserter(const K& k, const V& x); TPos eraser(TPos& v); //TPos restructe(const TPos& v); private: LinkedBinaryTree T; int n; public: class Iterator { private: TPos v; public: Iterator(const TPos& vv) : v(vv) {} const E& operator*() const { return *v; } const E& operator*() { return *v; } bool operator==(const Iterator& p) const { return v == p.v; } Iterator& operator++(); friend class SearchTree; }; }; | cs |
C4430 형식 지정자가 없습니다. int로 가정합니다. 참고: C++에서는 기본 int를 지원하지 않습니다.
얘네가 계속 나오네요..ㅠㅠㅠ
죄송합니다. 댓글 작성은 회원만 가능합니다.
번호 | 제 목 | 이름 | 날짜 | 조회 | 추천 | |||||
---|---|---|---|---|---|---|---|---|---|---|
31 | [본삭금] 리눅스 커널 코드 질문이요 ㅠㅠ [1] | 안녕하세 | 19/12/26 17:21 | 49 | 0 | |||||
30 | 웹개발 개인프로젝트 질문입니다 [8] | 안녕하세 | 19/07/04 00:38 | 154 | 0 | |||||
▶ | [본삭금] c++ 이진탐색트리 구현 질문입니다.. ㅠㅠ [3] | 안녕하세 | 19/06/05 00:39 | 115 | 0 | |||||
28 | [본삭금] Doubly Linked List 구현 질문입니다 ㅠㅠ [2] | 안녕하세 | 19/05/11 21:35 | 87 | 0 | |||||
27 | [본삭금] vector stl capacity 질문입니다ㅠㅠ [3] | 안녕하세 | 19/04/28 20:56 | 68 | 0 | |||||
26 | [본삭금] C++ 배열 확장 질문이요 [5] | 안녕하세 | 19/03/22 19:12 | 95 | 0 | |||||
25 | [본삭금] C언어 포인터, 주소 질문입니다. [3] | 안녕하세 | 19/03/14 23:48 | 162 | 0 | |||||
24 | [본삭금] C언어 포인터 질문입니다. [2] | 안녕하세 | 19/03/14 23:44 | 150 | 0 | |||||
23 | [본삭금]삽입정렬 구현인데 오류를 잘 모르겠어요 ㅠㅠ [6] | 안녕하세 | 18/09/18 22:00 | 46 | 0 | |||||
22 | [본삭금] c++ c2664 에러가 나는데 해결방법을 도저히 모르겠습니다 [5] | 안녕하세 | 18/04/17 23:59 | 47 | 0 | |||||
21 | [본삭금] c++ c2664해결방법좀 알려주세요 ㅠㅠ [3] | 안녕하세 | 18/04/15 22:32 | 45 | 0 | |||||
20 | c++ 에러 좀 도와주세요~!!! [2] | 안녕하세 | 15/11/04 22:19 | 25 | 0 | |||||
19 | c++초보자 질문이요 [3] | 안녕하세 | 15/10/24 08:59 | 28 | 0 | |||||
18 | c++ 과제좀 도와주세요~!!! 본삭금 [11] | 안녕하세 | 15/10/23 17:19 | 53 | 0 | |||||
17 | c++ 과제좀 도와주세요~!!! 본삭금 [1] | 안녕하세 | 15/10/12 02:37 | 62 | 0 | |||||
16 | 본삭금 과제질문이요~!~! [1] | 안녕하세 | 15/10/03 17:07 | 32 | 0 | |||||
15 | c++ 과제좀 도와주세요~!!! [2] | 안녕하세 | 15/09/20 19:07 | 37 | 0/4 | |||||
14 | c++ 과제좀 도와주세요~!!! [9] | 안녕하세 | 15/09/18 22:30 | 54 | 0 | |||||
13 | 아래글에 이어서 c++ 과제 도와주세요~!~!~ [5] | 안녕하세 | 15/09/12 17:57 | 41 | 0 | |||||
12 | c++과제좀 도와주세요~!~!~! [4] | 안녕하세 | 15/09/12 17:11 | 61 | 0 | |||||
11 | 본삭금 c언어 질문이요 ㅠㅠ [6] | 안녕하세 | 15/06/08 23:30 | 45 | 0 | |||||
10 | 본삭금 c언어 개초보입니다 ㅠㅠ질문이요 [3] | 안녕하세 | 15/06/07 23:33 | 32 | 0 | |||||
9 | 본삭금 c언어 질문이요 ㅠㅠ [3] | 안녕하세 | 15/06/07 22:53 | 32 | 0 | |||||
8 | 개초보 도와주세요 c언어 ㅠㅠ [2] | 안녕하세 | 15/06/07 18:16 | 45 | 0 | |||||
7 | 포인터 어려워요ㅠㅠ [2] | 안녕하세 | 15/06/07 16:39 | 56 | 0 | |||||
6 | c언어 개초보좀 도와주세요 [2] | 안녕하세 | 15/06/07 16:29 | 35 | 0 | |||||
5 | c언어 질문이요~~ [11] | 안녕하세 | 15/06/06 16:13 | 55 | 0 | |||||
4 | C언어 고수님들아 도와주세요 [2] | 안녕하세 | 15/06/06 14:27 | 59 | 0 | |||||
3 | c언어 개초보좀 도와주세요 [6] | 안녕하세 | 15/06/03 22:35 | 53 | 0 | |||||
2 | 고수님들 c언어 개초보좀 도와주세요 [3] | 안녕하세 | 15/06/03 21:23 | 39 | 0 | |||||
|
||||||||||
[1] [2] | ||||||||||