๋ชฉ๋ก์ ์ฒด ๊ธ (1099)
KoreanFoodie's Study
selection sort python code ์ ํ์ ๋ ฌ์ ํ์ด์ฌ ์ฝ๋๋ก ๊ตฌํํด ๋ณด์. ์ ํ์ ๋ ฌ(Selection sort ๊ธฐ๋ณธ ์ค๋ช ) ์ํคํผ๋์์ ์๋ ์ ์๋ฅผ ์ฐธ๊ณ ํด ๋ณด์. ์ ํ ์ ๋ ฌ(้ธๆๆดๅ, selection sort)์ ์ ์๋ฆฌ ์ ๋ ฌ ์๊ณ ๋ฆฌ์ฆ์ ํ๋๋ก, ๋ค์๊ณผ ๊ฐ์ ์์๋ก ์ด๋ฃจ์ด์ง๋ค. ์ฃผ์ด์ง ๋ฆฌ์คํธ ์ค์ ์ต์๊ฐ์ ์ฐพ๋๋ค. ๊ทธ ๊ฐ์ ๋งจ ์์ ์์นํ ๊ฐ๊ณผ ๊ต์ฒดํ๋ค(ํจ์ค(pass)). ๋งจ ์ฒ์ ์์น๋ฅผ ๋บ ๋๋จธ์ง ๋ฆฌ์คํธ๋ฅผ ๊ฐ์ ๋ฐฉ๋ฒ์ผ๋ก ๊ต์ฒดํ๋ค. ๋น๊ตํ๋ ๊ฒ์ด ์์ ์๊ฐ์ ์ด๋ฃจ์ด์ง๋ค๋ ๊ฐ์ ์๋, n๊ฐ์ ์ฃผ์ด์ง ๋ฆฌ์คํธ๋ฅผ ์ด์ ๊ฐ์ ๋ฐฉ๋ฒ์ผ๋ก ์ ๋ ฌํ๋ ๋ฐ์๋ Θ(n^2) ๋งํผ์ ์๊ฐ์ด ๊ฑธ๋ฆฐ๋ค. ์ ํ ์ ๋ ฌ์ ์๊ณ ๋ฆฌ์ฆ์ด ๋จ์ํ๋ฉฐ ์ฌ์ฉํ ์ ์๋ ๋ฉ๋ชจ๋ฆฌ๊ฐ ์ ํ์ ์ธ ๊ฒฝ์ฐ์ ์ฌ์ฉ์ ์ฑ๋ฅ ์์ ์ด์ ์ด ์๋ค. ๊ทธ๋ฆผ์ผ๋ก ํ..
These are OCaml Library module "List" implementation. Useful when we handle list data type in OCaml. let rec length l = match l with | [] -> 0 | _::t -> 1 + length t (* tail-recursive version of length *) let length' l = let rec f l result = match l with | [] -> result | _::t -> f t (result+1) in f l 0 let hd l = match l with | [] -> raise (Failure "hd") | h::_ -> h let tl l = match l with | [] ..
์์ ๋ค์ OCaml๋ก ๊ตฌํํด ๋ณด์. OCaml quicksort code (* pick the first element as a pivot *) (* ascending order *) let rec qsort comp l = match l with | [] -> [] | p::t -> let (l1,l2) = List.partition (fun x -> comp x p print_int x;print_string " ") l; print_newline(); print_endline "result of qsort : "; List.iter (fun x -> print_int x;print_string " ") (qsort compare l); print_newline() OCaml Stack code ๋ชจ๋..
์ด์ ๊ฒ์๊ธ์ ์ด์ด OCaml์์ ๊ผญ ์์์ผ ํ ์ค์ํ ๊ฐ๋ ๋ค์ ๋ํด ๋ ์์๋ณด๋๋ก ํ์. ์ฃผ์ ๊ฐ๋ ๋ค : Pair, Tuple, List, Currying, Inductive type, match-with ๊ตฌ๋ฌธ, Polymorphic type, try-with-raise, module system, reference. OCaml Pair Pair๋ ๋ ๊ฐ์ ๊ฐ์ ํ๋ฒ์ ๋ฌถ๋ ๋ฐ ํ์ฉ๋๋ค. ์ ์๋ (x, y)๊ฐ์ ์์ผ๋ก ํ ์ ์์ผ๋ฉฐ, ํ์ ์ a * bํํ๋ก ํ๊ธฐ๋๋ค. Pair์ ๊ฐ ํญ์ ์กฐํํ๋๋ฐ fst์ sndํจ์๋ฅผ ์ฌ์ฉํ ์ ์๋ค. let p:(int * string) = (1, "a") let i = fst p (* int, 1 *) let s = snd p (* string, "a" *) let..
OCaml ์ธ์ด : Ocaml์ ์ฌ๋ฌ๊ฐ์ง ์ฌ์ฉ๋ฒ์ ๊ฐ์ง๋ ์์ (high-level)์ธ์ด์ด๋ค. ์ ์ฐจํ(imperative), ๊ฐ์ฒด์งํฅ(object oriented), ํจ์ํ(functional) ๋ฑ์ ํ๋ก๊ทธ๋๋ฐ์ ๋ชจ๋ ์ง์ํ๋ค. Java์ฒ๋ผ, ์๋์ผ๋ก ๋ฉ๋ชจ๋ฆฌ๋ฅผ ๊ด๋ฆฌํด ์ฃผ๋ Garbage collector๊ฐ ์กด์ฌํ๋ค. ํ์ ์์คํ ์ด ๋ด์ฅ๋์ด ๋งค์ฐ ์์ ์ ์ผ๋ก ์ฌ์ฉํ ์ ์๋ค. ์ ์ฐจํ VS ๊ฐ ์ค์ฌํ ์ ์ฐจํ ์ธ์ด๋ ๊ธฐ๊ฒ์๊ฒ ์์๋๋ก ๋ช ๋ น์ ์ ๋ฌํ๋ค. ํจ์ํ ์ธ์ด์ ๊ฒฝ์ฐ, ๊ฐ ์ค์ฌ์ผ๋ก ๊ธฐ๊ณ์๊ฒ ์์ ๊ณ์ฐ์ ์ํค๋ ์์ผ๋ก ๋์ํ๋ค. OCaml ๊ธฐ์ด - ๊ฐ ์ ์ ์ ์ ๊ฐ let i = 1 ๋ฌธ์์ด ๊ฐ let s = "hello world" Boolean ๊ฐ let b = true unit let _ = print_e..
I'm introducing fine Korean restaurants/places where actual local Koreans usually go, not just tourist-targeted restaurants. Brief Review : - Name : Dos Tacos - Summary : Fine place to eat nice mexican foods, especially tacos. Well, it's actually street food, but I'm more of a begger than a prince, so street food would suffice to me. Oh, I love chimichanga. *Deadpool: TIME TO MAKE THE CHIMI-****..
I'm introducing fine Korean restaurants/places where actual local Koreans usually go, not just tourist-targeted restaurants. Brief Review : - Name : Pizza School (ํผ์ ์ค์ฟจ) - Summary : Fine place to have cheap pizza, but It's worth it! It's the cheapest franchise, serving pizza and spaghetti. The cheapest one only costs 6000 Korean Won, which is about 5$. But I personally recommend pepperoni pizza,..
Solution maual to Linear Algebra, Fourth Edition, Stephen H. Friedberg. (Chapter 7) Solutions to Linear Algebra, Fourth Edition, Stephen H. Friedberg. (Chapter 7) Linear Algebra solution manual, Fourth Edition, Stephen H. Friedberg. (Chapter 7) Linear Algebra solutions Friedberg. (Chapter 7) 1.Label(a)(b)(c)(d)(e)(f )(g)(h)the following statements as true or false. Eigenvectors of a linear opera..
Solution maual to Linear Algebra, Fourth Edition, Stephen H. Friedberg. (Chapter 6) Solutions to Linear Algebra, Fourth Edition, Stephen H. Friedberg. (Chapter 6) Linear Algebra solution manual, Fourth Edition, Stephen H. Friedberg. (Chapter 6) Linear Algebra solutions Friedberg. (Chapter 6) 1.2.Label the following statements as true or false. (a)(b)(c)(d)(e)(f )(g)(h)An inner product is a scala..
Solution maual to Linear Algebra, Fourth Edition, Stephen H. Friedberg. (Chapter 5) Solutions to Linear Algebra, Fourth Edition, Stephen H. Friedberg. (Chapter 5) Linear Algebra solution manual, Fourth Edition, Stephen H. Friedberg. (Chapter 5) Linear Algebra solutions Friedberg. (Chapter 5) 1. Label the following statements as true or false. (a) Every linear operator on an n-dimensional vector ..