[ create a new paste ] login | about

kabhwan

Name: Heart
Email:
Site/Blog: http://dev.heartsavior.net
Location:
Default language: Ruby
Favorite languages: Java
About:

Saved pastes by kabhwan:

C, pasted on Jul 9:
1
2
3
4
5
// Codepad 에서 sin() 을 인식못함... 그래서 실행은 안 걸어둠

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
...
view (104 lines)
C++, pasted on Jul 8:
1
2
3
4
5
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define INPUT_FILE_NAME		"input.txt"
...
view (192 lines)
C++, pasted on Jun 25:
1
2
3
4
5
#include <stdio.h>
#include <string.h>

#define MAX_STRING_LENGTH		100
#define MAX_MATCH_STRING_LENGTH	20
...
view (80 lines, 1 line of output)
C++, pasted on Jun 17:
1
2
3
4
#include <stdio.h>

#define MAX_STRING_LENGTH		100
#define MAX_MATCH_STRING_LENGTH		20
...
view (51 lines, 1 line of output)
Ruby, pasted on Oct 27:
1
2
3
4
5
class Rule
  attr_reader :rule_name, :lhs_list, :rhs
  
  def initialize(rule_name, lhs_list, rhs_str)
    @rule_name = rule_name
...
view (285 lines)
C++, pasted on Sep 24:
1
2
3
4
5
/*
	HW 1 - Problem 7
	
	Merge Sorting(non-recursive)
	
...
view (230 lines, 1 line of output)
Ruby, pasted on Sep 11:
1
2
3
4
5
=begin
Context-Free Grammar - Sentences Generator
=end

class ContextFreeGrammar
...
view (216 lines, 12 lines of output)
Ruby, pasted on Sep 3:
1
2
3
4
5
class String
  def digit_sum
    match_data_arr = self.scan(/[0-9]/)

    return 0 if !match_data_arr
...
view (17 lines, 1 line of output)
Ruby, pasted on Aug 11:
1
2
3
4
5
class BinaryTreeNode
  attr_accessor :left_child, :right_child, :parent, :data

  def initialize(data)
    @left_child = @right_child = @parent = nil
...
view (230 lines, 21 lines of output)
Ruby, pasted on Aug 7:
1
2
3
4
5
def compare_items_element(item1, item2, elem_idx)  
  ch_item1 = item1[elem_idx]
  ch_item2 = item2[elem_idx]

  if !ch_item1 && !ch_item2
...
view (118 lines, 6 lines of output)
Ruby, pasted on Aug 7:
1
2
3
4
5
def compare_items_element(item1, item2, elem_idx)  
  ch_item1 = item1[elem_idx]
  ch_item2 = item2[elem_idx]

  if !ch_item1 && !ch_item2
...
view (111 lines, 6 lines of output)
C++, pasted on Jul 13:
1
2
3
4
5
#define MAX_VALUE 10
#define MAX_STACK_SIZE 10

class MazeStack 
{ 
...
view (51 lines)
Ruby, pasted on May 11:
1
2
3
4
=begin
분리 집합(DisjointSet) 을 구현한다

=end
...
view (44 lines, 3 lines of output)
Ruby, pasted on May 11:
1
2
3
4
=begin
수식 트리 만들고 계산하기
후위 수식을 받아서 트리를 만들고 계산한다
중위 수식을 후위 수식으로 변경하는 것은 생략
...
view (98 lines, 2 lines of output)
Ruby, pasted on May 7:
1
2
3
4
=begin
N-Queen Problem

=end
...
view (67 lines, 10 lines of output)
Ruby, pasted on May 6:
1
2
3
4
=begin
Backtracking 을 이용하여 미로 탈출

=end
...
view (209 lines, 11 lines of output)
Ruby, pasted on May 6:
1
2
3
4
5
=begin
Divide & Conquer 를 이용하여 n 번째 피보나치 수열의 수를 구하기

http://dev.heartsavior.net/288
=end
...
view (70 lines, 1 line of output)
Ruby, pasted on May 6:
1
2
3
4
5
=begin
Divide & Conquer 를 이용하여 거듭제곱 구하기

http://dev.heartsavior.net/287
=end
...
view (16 lines, 1 line of output)
Ruby, pasted on May 6:
1
2
3
4
5
=begin
Divide & Conquer  이용하여 n 번째 피보나치 수열의 수를 구하기

우리에게 많이 알려진 재귀함수로 피보나치를 구하면 피보나치 재귀에서 엄청난 중복이 생긴다.
피보나치 수열을 아래와 같이 행렬식으로 변환하면 n번의 제곱으로 수를 구할  있다.
...
view (85 lines, 1 line of output)
Ruby, pasted on May 6:
1
2
3
4
5
=begin
거듭제곱  점화식

  c^n = c^(n/2) * c^(n/2), n is even
        c^((n-1)/2) * c^((n-1)/2) * c, n is odd
...
view (21 lines, 1 line of output)
Ruby, pasted on May 6:
1
2
3
4
5
=begin
거듭제곱  점화식

  c^n = c^(n/2) * c^(n/2), n is even
        c^((n-1)/2) * c^((n-1)/2) * c, n is odd
...
view (28 lines, 1 line of output)
Ruby, pasted on Apr 23:
1
2
3
4
5
# :title: Modified Title
# \:title: Modified Title -> Set Page title to 'Modified Title'
#
# :main: lib/test_rdoc_3.rb
# \:main: lib/test_rdoc_3.rb -> Set start page to 'lib/test_rdoc_3.rb' 's RDoc document page
...
view (45 lines)
Ruby, pasted on Apr 23:
1
2
3
4
5
# :title: Modified Title
# \:title: Modified Title -> Set Page title to 'Modified Title'
#
# :main: lib/test_rdoc_3.rb
# \:main: lib/test_rdoc_3.rb -> Set start page to 'lib/test_rdoc_3.rb' 's RDoc document page
...
view (45 lines, 1 line of output)
Ruby, pasted on Apr 23:
1
2
3
4
class TestRDoc2
  def fred
    line = 'Line'
    address = 'Address'
...
view (36 lines)
Ruby, pasted on Apr 23:
1
2
3
4
5
#_class_ <b>comment</b> +test+
#  Indenting...
#woowang, \+good\+ method_1
#--
#Normal Comment, so it does not include to rdoc
...
view (59 lines, 1 comment)
Ruby, pasted on Apr 8:
1
2
3
4
5
# C/C++ 로 배우는 자료구조론 연습문제 7.33

class CircularQueue

  def initialize(size)
...
view (67 lines, 41 lines of output)
Ruby, pasted on Apr 8:
1
2
3
4
5
# C/C++ 로 배우는 자료구조론 연습문제 7.32

class CircularQueue

  def initialize(size)
...
view (77 lines, 12 lines of output)
Ruby, pasted on Apr 8:
1
2
3
4
5
# C/C++ 로 배우는 자료구조론 연습문제 7.25

class CircularQueue

  def initialize(size)
...
view (101 lines, 6 lines of output)
Ruby, pasted on Apr 8:
1
2
3
4
5
# C/C++ 로 배우는 자료구조론 연습문제 7.24

class CircularQueue

  def initialize(size)
...
view (100 lines, 6 lines of output)
Ruby, pasted on Apr 8:
1
2
3
4
5
# C/C++ 로 배우는 자료구조론 연습문제 6.34

class DropOutStack

  def initialize(size)
...
view (60 lines, 8 lines of output)
Ruby, pasted on Apr 8:
1
2
3
4
5
# C/C++ 로 배우는 자료구조론 연습문제 6.29

class DualStack

  def initialize(size)
...
view (74 lines, 11 lines of output)
Ruby, pasted on Apr 8:
1
2
3
4
5
# C/C++ 로 배우는 자료구조론 연습문제 6.28

class Stack

  def initialize(size)
...
view (69 lines, 2 lines of output)
Ruby, pasted on Apr 7:
1
2
3
4
5
# C/C++ 로 배우는 자료구조론 연습문제 4.28

def func(num, n)
  puts num * n
  func(num, n * 2) if num * n < 3600
...
view (10 lines, 14 lines of output)
Ruby, pasted on Apr 7:
1
2
3
4
5
# C/C++ 로 배우는 자료구조론 연습문제 4.25

def ackermann(n, m)
  if 0 == n
    return m + 1
...
view (14 lines, 1 line of output)
Ruby, pasted on Apr 7:
1
2
3
4
# C/C++로 배우는 자료구조론 연습문제 4.19

def gcd(num1, num2)
  return -1 if num1 < num2
...
view (11 lines, 1 line of output)
Ruby, pasted on Apr 7:
1
2
3
4
5
# C/C++로 배우는 자료구조론 연습문제 4.18

def binary_search(array, left, right, find_num)
  return -1 if left > right
  
...
view (20 lines, 4 lines of output)
Ruby, pasted on Apr 7:
1
2
3
4
# C/C++로 배우는 자료구조론 연습문제 4.17

def get_sum(num_arr, size)
  return 0 if size == 0
...
view (9 lines, 1 line of output)
Ruby, pasted on Apr 7:
1
2
3
4
5
# C/C++로 배우는 자료구조론 연습문제 4.15

def PrintDecimalReverse(n)
  if n == 0
    puts
...
view (12 lines, 1 line of output)
Ruby, pasted on Apr 7:
1
2
3
4
5
# C/C++로 배우는 자료구조론 연습문제 4.11

def print1toN(n)
  print1toN(n-1) if n > 1
  print n
...
view (8 lines, 1 line of output)
Ruby, pasted on Apr 7:
1
2
3
4
# C/C++로 배우는 자료구조론 연습문제 4.14

def WriteBackward(str_array, array_size)
  return if array_size < 1
...
view (10 lines, 1 line of output)