반응형

전체 글 98

Lecture 06: Machine-Level Programming 2: Control

Control: Condition codes Processor State (x86-64, Partial) x86-64에는 16개의 register가 존재 rsp는 stack을 나타내는 레지스터 rip는 명령문을 가리키는 레지스터 condition codes는 주어진 4개의 1 bit flag 말고도 8개가 존재 Condition Codes (Implicit Setting) CF : 너무 큰 수의 연산에서 MSB 비트에서 올림이 발생한 경우 ZF : 연산으로 인해 0의 값이 발생한 경우 SF : 두 수의 연산으로 인해 음수의 값이 발생한 경우 OF : 연산에서 overflow가 발생한 경우(positive overflow & negative overflow) Condition Codes (Explicit ..

LeetCode - median of two sorted arrays

Median of Two Sorted Arrays - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 나의 풀이 - 실패 떠올린 방식 1. 하나의 배열에 모두 넣고 binary search - time complexity : O(n log n) - 문제의 시간 복잡도 제한 조건을 만족하지 못하는 풀이 2. lowerBound를 이용해서 해당 수보다 작거나 같은 수를 찾아서 각각 확인하는 방식 - time complexity : O(log (n + m)) - 배열의..

Leet Code - Longest Substring Without Repeating Characters

Longest Substring Without Repeating Characters - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 나의 풀이 class Solution { public int lengthOfLongestSubstring(String s) { int len = s.length(); Map map = new HashMap(); int maxLen = 0; int curLen = 0; for (int i = 0; i < len; i++) { if ..

Lecture 05: Machine-Level Programming 1: Basics

History of Intel processors and architectures Intel x86 Processors Complex instruction set computer (CISC) Many different instructions with many different formats Hard to match performance of Reduced Instruction Set Computers (RISC) 2015 State of the Art Core i7 Broadwell 2015 DDR : DRAM (메인 메모리)로 이어진다 PCI : Peripheral Devices로 이어진다 SATA : 여러 디스크로 이어진다 Ethernet : 네트워크로 이어진다 Our Coverage IA32 The..

Lecture 04: Floating Point

K Fractional Binary Numbers Representable Numbers Limitation 1 - Can only exactly represent numbers of the form x / 2^k - 다른 숫자들은 무한 소수가 된다 Limitation 2 - Just one setting of binary point within the w bits - 소수점을 왼쪽으로 옮기면 큰 수를 나타낼 수 없고, 오른쪽으로 옮기면 소수점 자리를 자세하게 나타내지 못한다 Floating Point Representation Precision Options Normalized Values When : exp != 0000...0 and exp != 1111...1 Normalized Encoding ..

Lecture 03: Bits, Bytes, and Integers (cont.)

Unsigned Addition in C Operands : w bits True Sum : w + 1 bits Discard Carry : w bits 따라서 Unsigned int 두 수의 합은 (실제 두 수의 합 mod 2^w) 의 값과 같다 Two's Complement Addition 두 수의 합에서 discard를 하더라도 실제 값과 동일한 경우가 존재한다 두 음수의 합에서 negative overflow가 발생하기도 한다 두 양수의 합에서 positive overflow가 발생하기도 한다 Unsigned Multiplication in C Operands : w bits True product : 2 * w bits Discard w bits : w bits 따라서 Unsigned int 두..

반응형