Skip to content

Instantly share code, notes, and snippets.

@Gumball12
Gumball12 / w1-1.cpp
Last active November 21, 2019 07:32
19-2h tutoring https://git.io/Je4r2
// https://rextester.com/KAY13591
// import modules
#include <iostream>
// define Character class
class Character {
private:
// declare fields
int x;
@Gumball12
Gumball12 / README.md
Last active October 4, 2021 10:53
Byte converter implemented by C lang (random int, double, char, string => byte)

Byte Converter

random int, double, char, string => byte

flow chart

@Gumball12
Gumball12 / index.c
Last active September 28, 2019 09:55
Bit-level operation
// cs-assignment 2-2 "Byte Manipulation - Byte Level Operation"
// @author shj
// import modules
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define STR_SIZE 10 // string size
#define TESTING_TIMES 30 // for unit-testing
@Gumball12
Gumball12 / integer-addition.c
Last active October 3, 2019 15:15
side effects of type conversion, integer addition
// cs-assignment 2-4 "Byte Manipulation - Integer Addition"
// @author shj
// import modules
#include <stdio.h>
#include <limits.h> // for get limits the values of various variable types
/**
* integer addition with unsigned short int type
* @param a first operand
@Gumball12
Gumball12 / tcp-client.js
Created October 4, 2019 16:40
tcp/udp socket program
/**
* tcp socket programming (client-side)
* @author shj
*/
// import module
const net = require('net');
// create TCP socket
const client = new net.Socket();
@Gumball12
Gumball12 / index.c
Last active October 12, 2019 09:02
compute RTT values
/**
* compute RTT values
* (DevRTT, EstimatedRTT, TimeoutInterval)
* @author shj <https://github.com/Gumball12>
* */
// import module
#include <stdio.h>
#include <stdlib.h> // for absolute value function 'abs'
@Gumball12
Gumball12 / swap.c
Last active October 13, 2019 05:09
swap fucntion
#include <stdio.h>
/**
* swap function
* @param xp pointer x
* @param yp pointer y
* */
void swap(long *xp, long *yp) {
// define temporary values
long temp0 = *xp;
@Gumball12
Gumball12 / program.pro
Last active October 13, 2019 13:12
Implement of an Expert System in SWI-Prolog lang
동물원(X) :-
μ²™μΆ”(X).
포유λ₯˜(X) :-
μ²™μΆ”(X),
not(μ•ŒκΉœ(X)).
μ‘°λ₯˜(X) :-
μ²™μΆ”(X),
μ•ŒκΉœ(X),
@Gumball12
Gumball12 / 19-2-h-ai.md
Last active October 4, 2021 10:52
μ‹œν—˜μš© (h: 쀑간고사, f: 기말고사)

탐색

  • 탐색

    • μƒνƒœκ³΅κ°„ λ‚΄μ—μ„œ
    • μ‹œμž‘μƒνƒœμ—μ„œ λͺ©ν‘œμƒνƒœκΉŒμ§€μ˜ 경둜λ₯Ό μ°ΎλŠ” 것
    • 각 μƒνƒœλ₯Ό μƒμ„±ν•˜λŠ” 것을 μ—°μ‚°μž 라고 함
  • μƒνƒœ, μ—°μ‚°μž, 그리고 μƒνƒœ 트리λ₯Ό μ΄μš©ν•΄ 닡을 μ°Ύμ•„λ‚˜κ°€λŠ” 것

    • λ¬Όλ‘  이λ₯Ό 직접 ν”„λ‘œκ·Έλž˜λ° ν•˜μ§€λŠ” μ•ŠμœΌλ©°, DFS/BFS λ₯Ό μ‚¬μš©ν•΄ ν’€μ–΄λ‚˜κ°
  • μ•Œκ³ λ¦¬μ¦˜

@Gumball12
Gumball12 / 1128.md
Last active November 28, 2019 07:24
19-2 νŠœν„°λ§ 문제 λͺ©λ‘

λ‹€μŒμ„ λ§Œμ‘±ν•˜λŠ” ν΄λž˜μŠ€μ™€ ν•¨μˆ˜λ₯Ό μž‘μ„±ν•΄μ£Όμ„Έμš”

flow

  • Shape 클래슀

    • 상속을 μœ„ν•œ 클래슀
    • private μ ‘κ·Όμžλ₯Ό κ°–λŠ” name ν•„λ“œκ°€ 쑴재
    • Shape 클래슀λ₯Ό μƒμ†λ°›λŠ” ν΄λž˜μŠ€λŠ” getArea λ©”μ„œλ“œλ₯Ό λ°˜λ“œμ‹œ κ΅¬ν˜„ν•΄μ•Όλ§Œ 함
    • getArea λ©”μ„œλ“œλŠ” λ„ν˜•μ˜ 넓이λ₯Ό λ°˜ν™˜
  • Rect 클래슀