CS/자료구조 7

Programming Exercise: Lab #2

경희대학교 박제만 교수님의 자료구조 수업을 기반으로 정리한 글입니다.Exercise #1ProblemsImplement (1) BinarySearch(int item) and (2) BinarySearchNearest(int item).Assume that there are No duplicated elements in the list.▶ (1) BinarySearch(int item) is the function we already learned in the class.The only difference is that "it returns the index of the item" if foundOtherwise, it returns -1template int SortedType::BinarySearch..

CS/자료구조 2025.04.06

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

Chapter 3: Stack

경희대학교 박제만 교수님의 자료구조 수업을 기반으로 정리한 글입니다.StackWhat is Stack?▶ Logical (or ADT) level Stack is a group of homogeneous items (elements).Removal (pop) and addition (push) of stack items can only occur at the top of the stack. A stack is a LIFO "Last In, First Out" structure.e.g., Undo(무효로 하다, Ctrl + z), Back (browser 뒤로가기), Stack trace ※ stack trace: 프로그램에서 에러가 발생했을 때, 문제를 추적할 수 있도록 함수 호출 순서를 보여주는 로그이..

CS/자료구조 2025.03.28

Programming Exercise: Lab #1

경희대학교 박제만 교수님의 자료구조 수업을 기반으로 정리한 글입니다.Encoding errors▶ 운영체제별로 줄 바꿈 문자를 채택한 게 다르다.CR (Carriage Return, \r): 커서가 해당 라인의 젤 앞쪽으로 이동 e.g., Mac OS (클래식 버전)LF (Line Feed, \n): 커서는 그대로 있으면서 줄만 바꿈 e.g., Unix, Linux, Mac OS (현대 버전)CRLF (CR + LF, ENTER): 줄도 바꾸면서 커서도 제일 앞쪽으로 이동 e.g, Windows간혹 협업을 하다 보면 어떤 사람이 Mac OS에서 작업한 코드를 Windows에서 받아 실행 시키려고 하면 에러가 나는 경우가 있다.따라서, Mac에서 작성된 파일을 Windows에서 사용할 경우, “LF” or..

CS/자료구조 2025.03.25

Chapter 2: Unsorted/Sorted Lists

경희대학교 박제만 교수님의 자료구조 수업을 기반으로 정리한 글입니다.List DefinitionsLinear relationship:Each element except the first has a unique predecessor(전임자), and each element except the last has a unique successor(후임자).Length:The number of items in a list; the length can vary over time. (e.g., append, remove)Unsorted list vs Sorted list ※ 배열(Array) vs 리스트(List)C 같은 언어에서 사용하는 배열(Array)은 크기가 고정되어 있어서 한 번 선언하면 크기를 바꿀 수 없..

CS/자료구조 2025.03.23

Chapter 1: Software, Data Structure, and C++

경희대학교 박제만 교수님의 자료구조 수업을 기반으로 정리한 글입니다.What is abstraction?▶ Too abstract.▶ Too concrete(명확한).▶ Between too abstract and too concrete.AbstractionA model of a complex system that includes only the details essential to the perspective of the viewer of the system. Programs are abstractions.Tells what the program mus do, but not how the program does it.Abstraction Data Type (ADT)▶ ADT A data type who..

CS/자료구조 2025.03.22

Chapter 0: Introduction

경희대학교 박제만 교수님의 자료구조 수업을 기반으로 정리한 글입니다.What do we learn?Data StructureDataThe way to represent information in a suitable format for communication or analysis by humans or maachines. Data StructureWe should be able to properly manage a collection of data elements.Why should we learn data structure?to develop a high-quality programIt works.It can be modified without excessive time and effort.It is ..

CS/자료구조 2025.03.21