stack 3

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 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

Lecture 06: Instructions - Language of the Computer - 3

경희대학교 김정욱 교수님의 컴퓨터 구조 수업을 기반으로 정리한 글입니다.Explanation of 32 Registers32 Registers$zero: contains 0 value$a0 ~ $a3: function argument, 함수를 호출할 때 전달하는 인자$v0, $v1: return values, 최종 결과값을 전달할 때 사용$t0 ~ $t9: temporary register (do not have to preserve), 덮어쓰기 가능 (메모리에 저장 X)$s0 ~ $s7: saved registers (preserve), 덮어쓰기 불가능 (메모리에 저장)$gp: global pointer (to access static data ex) constant value)$sp: stack po..

CS/컴퓨터 구조 2024.10.08