queue 4

Programming Exercise: Lab #4

경희대학교 박제만 교수님의 자료구조 수업을 기반으로 정리한 글입니다.Exercise #1ProblemsImplement linked structure STACK.~StackType(): destructorsize(): returns the length of stackpush(): pushes a new item into the stackpop(): pops and returns the item at the top of stack (if the stack is empty, return -1)StackType::~StackType(){ NodeType* tempPtr = topPtr; while (tempPtr != nullptr) { topPtr = topPtr->next; ..

CS/자료구조 2025.04.19

Chapter 5: Linked Structures

경희대학교 박제만 교수님의 자료구조 수업을 기반으로 정리한 글입니다.Linked Structure Array-based Stack Implementation▶ In the previous implementation, we consider an entire stack (a set of items) as a single object (array). New stack Implementation▶ Here, we consider each item in the stack a single object (Node).How could we define relationships between items? (Who's on top of whom?)Node Implementation▶ A pointer can be used..

CS/자료구조 2025.04.16

Programming Exercise: Lab #3

경희대학교 박제만 교수님의 자료구조 수업을 기반으로 정리한 글입니다.Exercise #1ProblemsImplement rotateFirstItem() in Circular Queue with Reserved space.This function "ROTATES" the first item of the queue.▶ Both are OKAY (in-place or not)! HINT: It is allowed to call "other member functions" inside a member function.e.g., enqueue(), dequeue(), isEmpty(), etc.)templatevoid QueueType::rotateFirstItem(){ if(isEmpty()){ ..

CS/자료구조 2025.04.16

Chapter 4: Queue

경희대학교 박제만 교수님의 자료구조 수업을 기반으로 정리한 글입니다.QueueWhat is Queue?▶ Logical (or ADT) level Queue is an ordered group of homogeneous items (elements).New elements are added at one end (the rear) -- enqueue.Elements are removed from the other end (the front) -- dequeue. A queue is a FIFO "First In, First Out" structure. (선입선출)e.g., Job buffers, Network buffers, and many others (일을 순서대로 처리해야 되는 모든 상황) ※ buf..

CS/자료구조 2025.03.31