DataStructure2 Graphs G = ( Vertex, Edge )의 튜플 V : 정점(vertices, nodes)들의 집합 _ a finite, nonempty 해야함 E : 정점들 간의 연결(edges) Directed vs Undirected graphs 방향성의 유무 차이. Directed graph 를 줄여 digraph라고도 함. 방향성 있을 때는 순서쌍의 순서가 중요하다. 트리는 그래프의 특별한 경우. Adjacent nodes : 연결되있는 두 노드 [5 is adjacent to 7] & [7 is adjacent from 5] Path : 노드 A에서 B로 갈 때 지나가는 노드들의 집합 (순서가 중요하다) Complete graph : 어떠한 정점 2개를 골라도 두 정점 사이에 edge가 존재하는 그래프 Graph.. 2023. 6. 9. Priority Queues Priority Queue 우선순위를 가진 요소에 언제든 접근할 수 있는 구조 PQType(int max) items : 구조체 HeapType 이름. elements : HeapType 멤버 중 데이터 저장하는 배열. template PQType::PQType(int max){ length = 0; items.elements = new ItemType[max]; maxItems = max; } ~PQType() 배열을 삭제해줘야한다! template PQType::~PQType(){ delete []items.elements; } void MakeEmpty() template void PQType::MakeEmpty(){ length = 0; } bool IsEmpty() template bool PQ.. 2023. 6. 9. 이전 1 다음