본 프로젝트에서는 이진 탐색 트리(Binary Search Tree, BST)와 연결 리스트(Linked List), 큐(Queue), 힙(Heap)을 이용하여 계정 관리 프로그램을 구현한다. 이 프로그램은 파일로부터 사용자 이름과 나이, 계정 ID를 읽어 Queue를 구축하며, 해당 Queue를 Account_Queue라 부른다. pop 명령을 실행하면 Queue에서 데이터를 방출하여 Account_BST와 User_List에 저장한다. Account_BST는 계정 ID와 사용자 이름으로 노드를 구성하며, 계정 ID를 기준으로 BST를 연결한다. User_List는 사용자 이름과 나이, 사용자가 보유한 계정 수로 노드를 구성하며, 노드가 입력된 순서대로 List를 연결한다. User_List에 존재하지 않는 사용자의 계정 정보가 입력될 경우 List에 노드를 추가하고, 이미 존재하는 사용자의 계정 정보가 입력될 경우 해당 노드를 수정한다. User_List의 노드는 Account_BST 노드를 가리키는 포인터를 추가로 가지며, 해당 User_List 노드의 사용자가 보유한 계정들을 Linked List로 연결한다. HeapLoad 명령을 실행하면 User_List의 정보들을 순서대로 읽어 연령대별 노드를 생성하고 User_Heap에 저장한다. User_Heap은 연령대와 연령대별 사용자 수로 노드를 구성하며, 연령대별 사용자 수를 기준으로 정렬된다. User_Heap에 존재하지 않는 연령대의 사용자 정보가 입력될 경우 Heap에 노드를 추가하고, 이미 존재하는 연령대의 사용자 정보가 입력될 경우 해당 노드의 사용자 수를 증가시킨다. 자료구조의 구축 방법과 조건에 대한 자세한 설명은 program implementation에서 설명한다.
9/13 - ver1 업로드
9/14 - ver1 그림 업데이트 및 밑줄 표시
Q. command.txt와 data.txt는 제공하지 않나요?
A. 네, 윈도우와 리눅스 인코딩 호환 문제로 따로 제공하지 않습니다.
- ls : list로 현재 작업중인 디렉토리의 파일 및 포함된 디렉토리 목록들을 표시 ( -a, -l 속성으로 자세한 출력 가능)
- pwd : print working directory로 현재 작업중인 디렉토리의 절대경로 위치 출력
- cd : change directory로 디렉토리 를 변경( . : 현재 디렉토리, .. : 상위 디렉토리 )
$ ls
Documents Download
$ ls -l
drwxr-xr-x 2 user user 4096 Sep 13 2020 Documents
drwxr-xr-x 2 user user 4096 Sep 26 2020 Downloads
$ pwd
/home/user
$ cd Download
$ pwd
/home/user/Downloads
$ sudo apt-get install git
$ git clone https://github.com/DSLDataStorage/DS_Project_1_2021_2.git
$ make
g++ -std=c++11 -g -o run AccountBST.cpp AccountBST.h AccountBSTNode.cpp AccountBSTNode.h AccountQueue.cpp AccountQueue.h AccountQueueNode.cpp AccountQueueNode.h main.cpp Manager.cpp Manager.h UserHeap.cpp UserHeap.h UserHeapNode.cpp UserHeapNode.h UserList.cpp UserList.h UserListNode.cpp UserListNode.h
$ ls
AccountBST.cpp AccountBST.h AccountBSTNode.cpp AccountBSTNode.h AccountQueue.cpp AccountQueue.h AccountQueueNode.cpp AccountQueueNode.h main.cpp Manager.cpp Manager.h UserHeap.cpp UserHeap.h UserHeapNode.cpp UserHeapNode.h UserList.cpp UserList.h UserListNode.cpp UserListNode.h **run**
$ ./run
$ cat log.txt
==> command 1) QLOAD
Success
$ ls
AccountBST.cpp AccountBST.h AccountBSTNode.cpp AccountBSTNode.h AccountQueue.cpp AccountQueue.h AccountQueueNode.cpp AccountQueueNode.h main.cpp Manager.cpp Manager.h UserHeap.cpp UserHeap.h UserHeapNode.cpp UserHeapNode.h UserList.cpp UserList.h UserListNode.cpp UserListNode.h
$ tar -czvf 2020202001_DS_project1.tar.gz *
AccountBST.cpp
AccountBST.h
AccountBSTNode.cpp
...
UserListNode.h
$ ls
**2020202001_DS_project1.tar.gz** AccountBST.cpp AccountBST.h AccountBSTNode.cpp AccountBSTNode.h AccountQueue.cpp AccountQueue.h AccountQueueNode.cpp AccountQueueNode.h main.cpp Manager.cpp Manager.h UserHeap.cpp UserHeap.h UserHeapNode.cpp UserHeapNode.h UserList.cpp UserList.h UserListNode.cpp UserListNode.h
$ ls
2020202001_DS_project1.tar.gz
$ tar -xzvf 2020202001_DS_project1.tar.gz
AccountBST.cpp
AccountBST.h
AccountBSTNode.cpp
...
UserListNode.h
$ ls
2020202001_DS_project1.tar.gz AccountBST.cpp AccountBST.h AccountBSTNode.cpp AccountBSTNode.h AccountQueue.cpp AccountQueue.h AccountQueueNode.cpp AccountQueueNode.h main.cpp Manager.cpp Manager.h UserHeap.cpp UserHeap.h UserHeapNode.cpp UserHeapNode.h UserList.cpp UserList.h UserListNode.cpp UserListNode.h