목록Computer Science/Data Structrue (5)
ROKO

Linear list 선형적인 순서를 가진 항목들의 집합 Commonalities - Linear data structure Differences - List can add and delete item at any index ArrayList Implemenatation #include using namespace std; //Remember : array index starts at 0 ! class ArrayList{ const static int MAX_SIZE = 100; int data[MAX_SIZE]; int length; public: ArrayList(){length = 0;} void insert(int pos,int item){ if(full()) throw 'list is full'..

Deque : abbreviation of double-ended queue front 와 rear에서 양쪽에서 삽입과 삭제가 가능한 queue Necessary components front : 맨 앞 index rear : 맨 뒤 index addFront(item) deleteFront() addRear(item) deleteRear() Additional components empty() full() getFront() : 맨 앞 데이터 값 반환 gerRear() : 맨 뒤 데이터 값 반환 size() Implementaition ArrayDeque #include #include "ArrayQueue.h" using namespace std; class ArrayDeque:public Arrra..

Queue Queue 는 대기줄이라는 의미가 있다. 일상생활에서 생각했을때 대기줄은 먼저 온 사람부터 나가게 되어있는데 그 부분을 그대로 구현한 자료구조이다. FIFO (First-In First_Out) 방식을 따른다. Necessary components front : queue의 맨 앞 index rear : queue의 맨 뒤 index enqueue(item) : item을 queue의 맨 뒤에 추가 dequeue() : 맨 앞의 요소를 삭제하며 반환 Additional operations empty() :queue가 비어있는지 확인 full() : queue가 가득 차있는지 확인 peek() : 맨 앞 부분 삭제하지 않고 반환 size() : queue의 현재 크기 반환 Implementati..

Python에는 array 개념이 없어지고 list만 남아있으므로 C++기반으로 알아보자. (이후 자료구조도 동일) C++의 개념을 충분히 알고 있다는 가정하에 설명하므로 모르는 부분은 나의 블로그 페이지나(내가 정리를 해놓았다면?) 구글링을 해보자. Stack 어원은 쌓다라는 의미로 이 의미와 비슷하게 쓰인다. LIFO (Last-in First-out) 의 방식으로 작동한다. Necessary Components push() : 데이터 저장 pop() : 데이터 추출, 저장공간에서도 삭제 top : 현재 데이터 사이즈 크기, 가장 위에 있는 데이터 위치 Addition operations peek() : 가장 위에 있는 데이터 확인 empty() : stack이 비어있는지 확인 full() : sta..

Data Structure a set of data & a set of operations on the data This is a structure that makes easy to access and to use data Appropriate DT(data structure) makes more faster and more efficient program, but inappropriate DT make performance worse ! General Data Structure Program = Data Structure(how easy to treat data) + Algorithm(how easy to solve problem) So be a good programmer, we should sele..