'Thinking about'에 해당되는 글 32건
- 2011.02.05 ShinyCocos
- 2011.01.25 노동법
- 2010.07.04 단위 테스트 지침 요약
- 2010.07.02 C# UnitTest by csUnit
- 2010.06.01 JOGL로 한 그래픽스 실습 <Lighitng>
- 2010.05.21 고려대 김예슬 자퇴글
- 2010.05.15 B-Tree
- 2010.05.11 그래픽스 : Solar System
- 2010.05.08 Python BST + AVL
- 2010.05.06 Python HW 2번문제
ShinyCocos
카테고리 없음 2011. 2. 5. 23:48
Cocos2D 루비 wrapper로 Cocos2d Document에 있는 Hello Action을 작성해본 코드
괜히 루비로 했나.ㅠ
자료가 별로 없네.ㅠ reverse왜 안먹는지 알수가 없군....
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | class MyLayer < Cocos2D::Layer class MyLayer < Cocos2D::Layer include Cocos2D def initialize @label = Label. new ( "Hello World" , "Marker Felt" , 64 ) win_size = Cocos2D::Director.win_size @label .position = [win_size[ 0 ]/ 2 ,win_size[ 1 ]/ 2 ] add_child @label action = Cocos2D::Actions::ScaleBy. new ( 3 . 0 , 2 . 5 , 2 . 5 ) @label .run_action(action) @sprite = Cocos2D::Sprite. new ( "grossini.png" ) @sprite .position = [ 0 , 50 ] add_child ( @sprite , :z => 1 ) rotateAction = Cocos2D::Actions::RotateBy. new ( 4 . 0 , 180 * 4 ) jumpAction = Cocos2D::Actions::JumpBy. new ( 4 ,[win_size[ 0 ], 0 ], 100 , 4 ) forward = Cocos2D::Actions::Spawn. new (rotateAction,jumpAction); backward = forward.reverse if backward == nil rotateAction2 = Cocos2D::Actions::RotateBy. new ( 4 . 0 ,- 180 * 4 ) jumpAction2 = Cocos2D::Actions::JumpBy. new ( 4 ,[-win_size[ 0 ], 0 ], 100 , 4 ) backward = Cocos2D::Actions::Spawn. new (rotateAction2,jumpAction2); end sequence = Cocos2D::Actions::Sequence. new (backward,forward); repeat = Cocos2D::Actions::Repeat. new (sequence, 2 ) @sprite .run_action repeat end end if $0 == "ShinyCocos" Cocos2D::Director.set_orientation Cocos2D::Director:: ORIENTATION_LANDSCAPE_RIGHT scene = Cocos2D::Scene. new layer = MyLayer. new scene.add_child(layer) Cocos2D::Director.run_scene scene else $stderr .puts "This script should be run only from a ShinyCocos environment" end |
휴일 대체 근무에 대한 법률
그리고 휴일의 사전대체를 하고자 할 때 그 실시일 전에 이러한 사실을 노동자에게 통보하여 주어야 하는데, 노동부의 행정해석에서는 적어도 24시간 이전에 해당 노동자에게 알려 줄 것을 요구하고 있다.(1994.5.16 근기 68207-806, 1979.7.6 법무 811-16173) 따라서 최소한 24시간 이전에 당해 노동자에게 사전 통보치 않고 휴일근로를 시킨 후 사후에 대체되는 휴일을 주더라도 이는 인정되지 않으며, 회사는 휴일근로수당을 지급해야 한다.
출처(ref.) : 노동OK - 노동칼럼 - 대체휴일이 유효하기 위한 요건 - http://www.nodong.or.kr/column/406911
노동절 대체휴일은 인정안돼
다만, 근로기준법상의 주휴일과 취업규칙, 단체협약에서 정한 약정휴일 등과 달리 근로자의날제정에관한법률에서 정한 ‘근로자의 날’(5월1일)은 법률로서 특정한 날을 유급휴일로 정하고 있으므로 회사가 또는 노사합의로 다른 날로 대체할 수 없으며, 다른 날로 대체휴일을 실시하였더라도 근로자의 날에 근로한 경우에는 근로기준법 제55조에 의한 휴일근로수당을 지급하여야 한다. ( 2004.02.19, 근로기준과-829)
다만, 근로기준법상의 주휴일과 취업규칙, 단체협약에서 정한 약정휴일 등과 달리 근로자의날제정에관한법률에서 정한 ‘근로자의 날’(5월1일)은 법률로서 특정한 날을 유급휴일로 정하고 있으므로 회사가 또는 노사합의로 다른 날로 대체할 수 없으며, 다른 날로 대체휴일을 실시하였더라도 근로자의 날에 근로한 경우에는 근로기준법 제55조에 의한 휴일근로수당을 지급하여야 한다. ( 2004.02.19, 근로기준과-829)
출처(ref.) : 노동OK - 노동칼럼 - 대체휴일이 유효하기 위한 요건 - http://www.nodong.or.kr/column/406911
출퇴근에서의 산업 재해여부
구 산업재해보상보험법(2007. 12. 14. 법률 제8694호로 전부 개정되기 전의 것) 제5조 제1호의 ‘업무상의 재해’라 함은 근로자와 사업주 사이의 근로계약에 터잡아 사업주의 지배․관리 아래 당해 근로업무의 수행 또는 업무준비, 마무리행위 등 업무에 수반되는 통상적인 활동을 하는 과정에서 이러한 업무에 기인하여 발생한 재해를 말하고, 근로자의 출·퇴근 행위란 근로자가 노무를 제공하기 위해 주거지와 근무지 사이를 사회통념상 합리적인 방법과 경로에 의해 왕복하는 반복적 행위를 말한다.
출처(ref.) : 노동OK - 법원 노동판례 - 업무상재해와 출퇴근 행위의 의미 - http://www.nodong.or.kr/case/753944
- 회사에서 교통비 명목으로 나오는 돈으로 가는 중 사고는 산업재해에 해당 (재영 정리)
생리휴가
기존 유급 생리휴가제도하에서는 여성근로자가 매월 1일의 유급생리휴가를 부여받을 수 있었으나, 개정법에서는 여성 근로자의 청구가 있을 때만 생리휴가를 부여하되, 생리휴가일은 무급으로 하도록 하고 있습니다. 규정됨으로써 연소자 보호의 취지가 감퇴된 것이 사실입니다.
출처(ref.) : 노동OK - 주5일제 - 생리휴가는 어떻게? (유급 → 무급으로) - http://www.nodong.or.kr/hours40/403801
우리 계약서 서면명시 의무화 지킴여부
- 휴무에 대한 직접 명시가 없고, 연차유급휴가에 관한 사항이 아예 없다.
위는 모든 근로자(정규직 및 단시간근로자, 계약직근로자, 파견근로자 등)에게 적용된다고 근로기준법에 나왓고
이를 어길 시 과태로 - 지금 해당하는 근로시간 및 휴게에 관한 사항/ 휴일 휴가에관한 사항 건단 30만원의 과태료
과태료를 매긴다는건 무효의 가능성도 잇다는 것
단위 테스트 지침 요약
카테고리 없음 2010. 7. 4. 15:00
일반 원칙
- 망가질 가능성이 있는 모든 것을 테스트한다.
- 망가지는 모든 것을 테스트한다.
- 새 코드는 무죄가 증명되기 전까지는 유죄
- 적어도 제품 코드만큼 테스트 코드를 작성한다.
- 컴파일을 할 때마다 지역테스트를 실행한다.
- 저장소에 체크인하기 전에 모든 테스트를 실행해 본다.
자문해 봐야 할 사항
- 이 코드가 옳게 작동한다면, 어떻게 그것을 알 수 있는가?
- 이것을 어떻게 테스트할 것인가?
- '그밖에' 어떤 것이 잘못될 수 있는가?
- 이와 똑같은 종류의 문제가 다른 곳에서도 일어날 수 있을까?
무엇을 테스트해야 하는가 RIGHT-BICEP
- 결과가 옳은가(right)?
- 모든 경계(Boundary)조건이 CORRECT한가?
-> EX) "fn2o8f892rnifd!@#@fdsja"라는 파일이름
"fred@daum." 과 같이 최상위 도메인이 없는 메일 주소
"10000"살이라는 사람의 나이
중복된 값이 없어야 하는 목록에서 중복된값
순서가 있는 목록인데 순서대로 되어있지 않은 경우
- Inverse 관계를 확인할 수 있는가?
-> EX)
double x = mySqrt(4.0);
Assert.Equals(4.0*4.0,x);
- 다른 수단을 사용해서 결과를 교차 확인(Cross-check)할 수 있는가?
-> EX)
Assert.Equals(Math.Sqrt(num), mySqrt(num));
- 에러 조건(error Condition)을 강제로 만들어낼 수 있는가?
-> 메모리 고갈, 디스크 공간 고갈, 네트워크 가용성과 에러 등...
- 성능(Performance)특성이 한도 내에 있는가?
좋은 테스트는 A-TRIP해야 한다.
- 자동적(Automatic)
- 철저함(Thorough)
- 반복가능(Repeatable)
- 독립접(Independent)
- 전문적(Professional)
CORRECT 경계조건
- 형식 일치(Conformance) - 값의 형식이 예쌍한 형식과 일치하는가?
- 순서(Order) - 적절히 순서대로 되어 있거나 그렇지 않은 값인가?
- 범위(Range) - 적당한 최소값과 최대값 사이에 있는 값인가?
- 참조(Reference) - 코드가 자기가 직접 제어하지 않는 외부 코드를 참조하는가?
- 존재성(existence) - 값이 전재하는가 ? (ex. null이 아님, 0이아님, 집합 안에 존재함 등)
- 개체수 (Cardinality) - 확실히 충분한값이 존재하는가?
- 시간 (Time)(절대적 or 상대적) - 모든 것이 순서대로 일어나는가? 제시간에? 때맞추어?
C# UnitTest by csUnit
Computer 기타 2010. 7. 2. 14:34
간단한 테스트 코드 예제
자동 생성된 코드에 class 선언에 public이 안붙는데 붙여주어야
csUnit에 나온다..

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace UNITcs { public class myStack<t> { private Stack<t> stack; public myStack(){ stack = new Stack<t>(); } public void Push(T a) { stack.Push(a); } public T Top() { return stack.Peek(); } public T Pop() { return stack.Pop(); } public void ex( int a) { int d = 3 / a; } } } </t></t></t> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | using System; using System.Collections.Generic; using System.Linq; using System.Text; using csUnit; namespace UNITcs { [TestFixture] public class StackTest { myStack< int > s = null ; [SetUp] public void init() { s = new myStack< int >(); } [Test] public void PushPopTest() { s.Push(10); s.Push(20); s.Push(30); s.Push(40); s.Push(50); int value = s.Top(); Assert.Equals(50, value); Assert.Equals(50, s.Pop()); Assert.Equals(40, s.Pop()); Assert.Equals(30, s.Pop()); } [Test] [ExpectedException ( typeof (System.DivideByZeroException))] public void PushPopTest2() { Console.Write( "12312312" ); s.ex(1); s.ex(0); } } } </ int ></ int > |
'Computer 기타' 카테고리의 다른 글
Pthread with Semaphore <posix> (0) | 2010.03.16 |
---|---|
Posix Thread 예제 소스 (0) | 2010.03.15 |
자바 Tar 묶음 파일 만들기 (0) | 2010.02.27 |
자바 - 정규표현식 예제입니다.<혼자보기용> (0) | 2010.02.27 |
JOGL로 한 그래픽스 실습 <Lighitng>
Sorce Bank 2010. 6. 1. 20:46
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | import java.awt.*; import java.awt.event.*; import com.sun.opengl.util.Animator; import javax.media.opengl.GL; import javax.media.opengl.glu.GLU; import javax.media.opengl.GLCanvas; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLEventListener; public class Lighting extends Frame implements GLEventListener, KeyListener { public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { System.exit( 0 ); } } public void keyReleased(KeyEvent e) { } public void keyTyped(KeyEvent e) { } public Lighting() { super ( "Lighting and Shading" ); setLayout( new BorderLayout()); setSize( 400 , 400 ); setLocation( 40 , 40 ); setVisible( true ); setupJOGL(); } /** * Called by the drawable immediately after the OpenGL context is * initialized; the GLContext has already been made current when * this method is called. * * @param drawable The display context to render to */ public void init(GLAutoDrawable drawable) { GL gl = drawable.getGL(); gl.glClearColor( 1 , 1 , 1 , 1 ); gl.glEnable(GL.GL_DEPTH_TEST); float light0_ambient[] = { 0 .0f, 0 .0f, 0 .0f, 1 .0f}; float light0_diffuse[] = { 0 .4f, 0 .6f, 0 .0f, 1 .0f}; float light0_specular[] = { 1 .0f, 1 .0f, 1 .0f, 1 .0f}; float light0_position[] = { 1 .0f, 1 .0f, 1 .0f, 0 .0f}; gl.glLightfv(GL.GL_LIGHT0, GL.GL_AMBIENT, light0_ambient, 0 ); gl.glLightfv(GL.GL_LIGHT0, GL.GL_DIFFUSE, light0_diffuse, 0 ); gl.glLightfv(GL.GL_LIGHT0, GL.GL_SPECULAR, light0_specular, 0 ); gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, light0_position, 0 ); gl.glEnable(GL.GL_LIGHTING); gl.glEnable(GL.GL_LIGHT0); float mat_ambient[] = { 0 .8f, 0 .8f, 0 .2f, 1 .0f}; float mat_diffuse[] = { 0 .1f, 0 .5f, 0 .8f, 1 .0f}; float mat_specular[] = { 1 .0f, 1 .0f, 1 .0f, 1 .0f}; float mat_emission[] = { 0 .0f, 0 .0f, 0 .0f, 1 .0f}; float mat_shininess = 50 .0f; gl.glLightfv(GL.GL_FRONT, GL.GL_AMBIENT, mat_ambient, 0 ); gl.glLightfv(GL.GL_FRONT, GL.GL_DIFFUSE, mat_diffuse, 0 ); gl.glLightfv(GL.GL_FRONT, GL.GL_SPECULAR, mat_specular, 0 ); gl.glLightfv(GL.GL_FRONT, GL.GL_EMISSION, mat_emission, 0 ); gl.glLightf(GL.GL_FRONT, GL.GL_SHININESS, mat_shininess); drawable.addKeyListener( this ); } /** * Called by the drawable when the surface resizes itself. Used to * reset the viewport dimensions. * * @param drawable The display context to render to */ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { } /** * Called by the drawable when the display mode or the display device * associated with the GLDrawable has changed */ public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) { } /** * Called by the drawable to perform rendering by the client. * * @param drawable The display context to render to */ public void display(GLAutoDrawable drawable) { GL gl = drawable.getGL(); GLU glu = new GLU(); // clear the frame buffer and the depth buffer gl.glClear(GL.GL_COLOR_BUFFER_BIT); gl.glClear(GL.GL_DEPTH_BUFFER_BIT); // set intrinsic properties of the camera gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); glu.gluPerspective( 45 .0f, 1 .0f, 0.0001 , 100000.0 ); // set extrinsic properties of the camera gl.glMatrixMode(GL.GL_MODELVIEW); gl.glLoadIdentity(); glu.gluLookAt( 3 .0f, 3 .0f, 3 .0f, 0 .0f, 0 .0f, 0 .0f, 0 .0f, 1 .0f, 0 .0f); gl.glEnable(GL.GL_LIGHTING); gl.glEnable(GL.GL_LIGHT0); /// draw objects draw_cube(drawable); // swap buffers (double buffering) //glutSwapBuffers(); } public void draw_cube(GLAutoDrawable drawable) { // TODO: set a proper normal for each face GL gl = drawable.getGL(); gl.glBegin(GL.GL_QUADS); // front gl.glNormal3f( 0 .0f, 0 .0f, 1 .0f); gl.glVertex3f( 1 .0f, 1 .0f, 1 .0f); gl.glVertex3f(- 1 .0f, 1 .0f, 1 .0f); gl.glVertex3f(- 1 .0f, - 1 .0f, 1 .0f); gl.glVertex3f( 1 .0f, - 1 .0f, 1 .0f); // back gl.glNormal3f( 0 .0f, 0 .0f, - 1 .0f); gl.glVertex3f( 1 .0f, - 1 .0f, - 1 .0f); gl.glVertex3f(- 1 .0f, - 1 .0f, - 1 .0f); gl.glVertex3f(- 1 .0f, 1 .0f, - 1 .0f); gl.glVertex3f( 1 .0f, 1 .0f, - 1 .0f); // right gl.glNormal3f( 1 .0f, 0 .0f, 0 .0f); gl.glVertex3f( 1 .0f, 1 .0f, 1 .0f); gl.glVertex3f( 1 .0f, - 1 .0f, 1 .0f); gl.glVertex3f( 1 .0f, - 1 .0f, - 1 .0f); gl.glVertex3f( 1 .0f, 1 .0f, - 1 .0f); // left gl.glNormal3f(- 1 .0f, 0 .0f, 0 .0f); gl.glVertex3f(- 1 .0f, 1 .0f, - 1 .0f); gl.glVertex3f(- 1 .0f, - 1 .0f, - 1 .0f); gl.glVertex3f(- 1 .0f, - 1 .0f, 1 .0f); gl.glVertex3f(- 1 .0f, 1 .0f, 1 .0f); // top gl.glNormal3f( 0 .0f, 1 .0f, 0 .0f); gl.glVertex3f( 1 .0f, 1 .0f, 1 .0f); gl.glVertex3f( 1 .0f, 1 .0f, - 1 .0f); gl.glVertex3f(- 1 .0f, 1 .0f, - 1 .0f); gl.glVertex3f(- 1 .0f, 1 .0f, 1 .0f); // bottom gl.glNormal3f( 0 .0f, - 1 .0f, 0 .0f); gl.glVertex3f(- 1 .0f, - 1 .0f, 1 .0f); gl.glVertex3f(- 1 .0f, - 1 .0f, - 1 .0f); gl.glVertex3f( 1 .0f, - 1 .0f, - 1 .0f); gl.glVertex3f( 1 .0f, - 1 .0f, 1 .0f); gl.glEnd(); } private void setupJOGL() { GLCapabilities caps = new GLCapabilities(); caps.setDoubleBuffered( true ); caps.setHardwareAccelerated( true ); GLCanvas canvas = new GLCanvas(caps); canvas.addGLEventListener( this ); add(canvas, BorderLayout.CENTER); Animator anim = new Animator(canvas); anim.start(); } public static void main(String[] args) { Lighting demo = new Lighting(); demo.setVisible( true ); } } |
'Sorce Bank' 카테고리의 다른 글
B-Tree (0) | 2010.05.15 |
---|---|
그래픽스 : Solar System (0) | 2010.05.11 |
Python BST + AVL (0) | 2010.05.08 |
Python HW 2번문제 (0) | 2010.05.06 |
Python HW 1번문제 (0) | 2010.05.06 |
고려대 김예슬 자퇴글
카테고리 없음 2010. 5. 21. 00:32
오늘 나는 대학을 그만둔다, 아니 거부한다
오늘 나는 대학을 그만 둔다. G세대로 '빛나거나' 88만원 세대로 '빚내거나', 그 양극화의 틈새에서 불안한 줄타기를 하는 20대. 그저 무언가 잘못된 것 같지만 어쩔 수 없다는 불안과 좌절감에 앞만 보고 달려야 하는 20대. 그 20대의 한 가운데에서 다른 길은 이것밖에 없다는 마지막 남은 믿음으로.
이제 나의 이야기를 시작하겠다.
이것은 나의 이야기이지만 나만의 이야기는 아닐 것이다. 나는 25년 동안 경주마처럼 길고 긴 트랙을 질주해왔다. 우수한 경주마로, 함께 트랙을 질주하는 무수한 친구들을 제치고 넘어뜨린 것을 기뻐하면서. 나를 앞질러 달려가는 친구들 때문에 불안해하면서. 그렇게 소위 '명문대 입학'이라는 첫 관문을 통과했다.
그런데 이상하다. 더 거세게 나를 채찍질해봐도 다리 힘이 빠지고 심장이 뛰지 않는다. 지금 나는 멈춰 서서 이 경주 트랙을 바라보고 있다. 저 끝에는 무엇이 있을까? '취업'이라는 두 번째 관문을 통과시켜 줄 자격증 꾸러미가 보인다. 너의 자격증 앞에 나의 자격증이 우월하고 또 다른 너의 자격증 앞에 나의 자격증이 무력하고, 그리하여 새로운 자격증을 향한 경쟁 질주가 다시 시작될 것이다. 이제서야 나는 알아차렸다. 내가 달리고 있는 곳이 끝이 없는 트랙임을. 앞서 간다 해도 영원히 초원으로는 도달할 수 없는 트랙임을.
이제 나의 적들의 이야기를 시작하겠다.
이 또한 나의 적이지만 나만의 적은 아닐 것이다. 이름만 남은 '자격증 장사 브로커'가 된 대학, 그것이 이 시대 대학의 진실임을 마주하고 있다. 대학은 글로벌 자본과 대기업에 가장 효율적으로 '부품'을 공급하는 하청업체가 되어 내 이마에 바코드를 새긴다. 국가는 다시 대학의 하청업체가 되어, 의무교육이라는 이름으로 12년간 규격화된 인간제품을 만들어 올려 보낸다.
기업은 더 비싼 가격표를 가진 자만이 피라미드 위쪽에 접근할 수 있도록 온갖 새로운 자격증을 요구한다. 이 변화 빠른 시대에 10년을 채 써먹을 수 없어 낡아 버려지는 우리들은 또 대학원에, 유학에, 전문과정에 돌입한다. 고비용 저수익의 악순환은 영영 끝나지 않는다. '세계를 무대로 너의 능력만큼 자유하리라'는 세계화, 민주화, 개인화의 넘치는 자유의 시대는 곧 자격증의 시대가 되어버렸다.
졸업장도 없는 인생이 무엇을 할 수 있는가? 자격증도 없는 인생이 무엇을 할 수 있는가? 학습된 두려움과 불안은 다시 우리를 그 앞에 무릎 꿇린다. 생각할 틈도, 돌아볼 틈도 주지 않겠다는 듯이 또 다른 거짓 희망이 날아든다. 교육이 문제다, 대학이 문제다라고 말하는 생각 있는 이들조차 우리에게 이렇게 말한다.
"성공해서 세상을 바꾸는 '룰러'가 되어라",
"네가 하고 싶은 것을 해. 나는 너를 응원한다",
"너희의 권리를 주장해. 짱돌이라도 들고 나서!"
그리고 칼날처럼 덧붙여지는 한 줄, "그래도 대학은 나와야지".
그 결과가 무엇인지는 모두가 알고 있으면서도. 큰 배움도 큰 물음도 없는 '대학大學'없는 대학에서, 나는 누구인지, 왜 사는지, 무엇이 진리인지 물을 수 없었다. 우정도 낭만도 사제간의 믿음도 찾을 수 없었다. 가장 순수한 시절 불의에 대한 저항도 꿈꿀 수 없었다. 아니, 이런 건 잊은 지 오래여도 좋다.
그런데 이 모두를 포기하고 바쳐 돌아온 결과는 정말 무엇이었는가. 우리들 20대는 끝없는 투자 대비 수익이 나오지 않는 '적자세대'가 되어 부모 앞에 죄송하다.
젊은 놈이 제 손으로 자기 밥을 벌지 못해 무력하다. 스무 살이 되어서도 내가 뭘 하고 싶은지 모르고 꿈을 찾는 게 꿈이어서 억울하다. 이대로 언제까지 쫓아가야 하는지 불안하기만 한 우리 젊음이 서글프다. 나는 대학과 기업과 국가, 그리고 대학에서 답을 찾으라는 그들의 큰 탓을 묻는다. 깊은 분노로. 그러나 동시에 그들의 유지자가 되었던 내 작은 탓을 묻는다. 깊은 슬픔으로. '공부만 잘하면' 모든 것을 용서받고, 경쟁에서 이기는 능력만을 키우며 나를 값비싼 상품으로 가공해온 내가 체제를 떠받치고 있었음을 고백할 수밖에 없다. 이 시대에 가장 위악한 것 중에 하나가 졸업장 인생인 나, 나 자신임을 고백할 수밖에 없다.
그리하여 오늘 나는 대학을 그만둔다. 아니, 거부한다.
더 많이 쌓기만 하다가 내 삶이 한번 다 꽃피지도 못하고 시들어 버리기 전에. 쓸모 있는 상품으로 '간택'되지 않고 쓸모 없는 인간의 길을 '선택'하기 위해. 이제 나에게는 이것들을 가질 자유보다는 이것들로부터의 자유가 더 필요하다. 자유의 대가로 나는 길을 잃을 것이고 도전에 부딪힐 것이고 상처 받을 것이다. 그러나 그것만이 삶이기에, 삶의 목적인 삶 그 자체를 지금 바로 살기 위해 나는 탈주하고 저항하련다.
생각한 대로 말하고, 말한 대로 행동하고, 행동한 대로 살아내겠다는 용기를 내련다. 학비 마련을 위해 고된 노동을 하고 계신 부모님이 눈 앞을 가린다. '죄송합니다, 이 때를 잃어버리면 평생 나를 찾지 못하고 살 것만 같습니다.' 많은 말들을 눈물로 삼키며 봄이 오는 하늘을 향해 깊고 크게 숨을 쉰다.
이제 대학과 자본의 이 거대한 탑에서 내 몫의 돌멩이 하나가 빠진다. 탑은 끄덕 없을 것이다. 그러나 작지만 균열은 시작되었다. 동시에 대학을 버리고 진정한 大學生의 첫발을 내딛는 한 인간이 태어난다. 이제 내가 거부한 것들과의 다음 싸움을 앞에 두고 나는 말한다.
그래, "누가 더 강한지는 두고 볼 일이다".
2010년 3월 10일 김예슬
고려대학교 경영학과를 자퇴하며
글글
B-Tree
Sorce Bank 2010. 5. 15. 23:29
Node.rb
B_Tree.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | class Node attr_accessor :keys , :parent def initialize (p, key) # keys = [P0, K1 ,P1, K2, ...., Pn ] if key. class == Array @keys = key else @keys = [ nil ,key, nil ] end @parent = p end # end of Constructor of Node class def addKey key for k in @keys if k == nil or k. class == Node next elsif key < k i = @keys .index(k) @keys .insert(i, nil ) @keys .insert(i,key) return i end end @keys .push(key) @keys .push( nil ) return @keys .index(key) end # end of addKey def delKey key for k in @keys if k == nil or k. class == Node next elsif key == k i = @keys .index(k) @keys .delete_at(i) @keys .delete_at(i) return true end end return false end def size # return NUmber of Keys return @keys .size()/ 2 end # end of size end #end of Node class |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | require 'Node' class B_Tree attr_accessor :Root def initialize m @Root = nil @M_WAY = m end # end of Constructor of B_Tree class def depth node keys = node.keys ps= [] for p in keys next if p. class == keys[ 1 ]. class ps.push(depth(p)) if p != nil end return 1 if ps == [] return 1 +ps.max end def isFull node if node.size() >= @M_WAY - 1 return true else return false end end # end of isFull def isUnder node if node.size() <= @M_WAY / 2 - 1 return true else return false end # end of isUnder end def inorder node if node == nil return end for k in node.keys if k. class ==Node inorder(k) elsif k == nil next else print k, "(" ,depth(node), ") " end end end # end of inorder def left_merge neighbor, parent, node keys, n_keys, p_keys = node.keys, neighbor.keys, parent.keys n_index = p_keys.index(neighbor) neighbor.addKey(p_keys[n_index+ 1 ]) n_keys.pop neighbor.keys = n_keys + keys 2 .times {p_keys.delete_at(n_index+ 1 )} for k in neighbor.keys if k. class == Node k.parent = neighbor end end end def right_merge neighbor, parent, node keys, n_keys, p_keys = node.keys, neighbor.keys, parent.keys n_index = p_keys.index(node) node.addKey(p_keys[n_index+ 1 ]) keys.pop node.keys = keys + n_keys 2 .times {p_keys.delete_at(n_index+ 1 )} for k in node.keys if k. class == Node k.parent = node end end end def left_loan neighbor, parent, node p_keys , n_keys,keys = parent.keys, neighbor.keys,node.keys n_index = p_keys.index(node) node.addKey(p_keys[n_index- 1 ]) keys[ 0 ],keys[ 2 ] = keys[ 2 ],keys[ 0 ] p_keys[n_index- 1 ] = n_keys[n_keys.size- 2 ] keys[ 0 ] = n_keys[n_keys.size- 1 ] keys[ 0 ].parent = node if keys[ 0 ] != nil neighbor.keys = n_keys.slice( 0 ,n_keys.size() - 2 ) end def right_loan neighbor, parent, node p_keys , n_keys,keys = parent.keys, neighbor.keys, node.keys n_index = p_keys.index(node) node.addKey(p_keys[n_index+ 1 ]) p_keys[n_index+ 1 ] = n_keys[ 1 ] keys[keys.size- 1 ] = n_keys[ 0 ] n_keys[ 0 ].parent =node if n_keys[ 0 ] != nil neighbor.keys = n_keys.slice( 2 ,n_keys.size()- 2 ) end def search skey cur_node = @Root found = false begin s_node = cur_node keys = cur_node.keys for k in keys cur_node = k if k == keys[keys.size- 1 ] next if k. class == Node or k == nil if skey == k found = true break elsif skey < k cur_node = keys[keys.index(k)- 1 ] break end # end of if end # end of for end while !found and cur_node!= nil return found, s_node end # end of search def insert nkey if @Root == nil @Root = Node. new ( nil ,nkey) return true else # Tree 가 비어있지 않을 때 duplicate, node = search(nkey) if duplicate puts "중복되는 데이터를 삽입하였습니다 #{nkey}" return false end newNode = nil while true # 잘 들어갈때 까지. unless isFull(node) # Node에 여유가 있을 때 i=node.addKey(nkey) keys = node.keys() keys[i+ 1 ] = newNode return true else i=node.addKey(nkey) keys = node.keys() keys[i+ 1 ] = newNode if node.size % 2 == 0 : center_index = keys.size/ 2 + 1 else center_index = keys.size/ 2 end leftkeys = keys.slice( 0 ,center_index) rightkeys = keys.slice(center_index+ 1 ,keys.size - center_index) node.keys = leftkeys newNode = Node. new (node.parent,rightkeys) tmpkeys = newNode.keys for p in tmpkeys if p. class == Node p.parent = newNode end end if node.parent == nil # 부모 노드가 존재하지 않을 때 @Root = Node. new ( nil ,keys[center_index]) rkeys = @Root .keys rkeys[ 0 ],rkeys[ 2 ] = node, newNode node.parent = newNode.parent = @Root return true else # 부모 노드가 존재할 경우 nkey = keys[center_index] node = node.parent end # end of 부모노드가 존재하지 않을 때 end # end of 노드에 여유가 있을 때 end # end of while end # end of 트리가 비어있지 않을 때 end # end of insert def delete dkey if @Root == nil puts "비어있는 트리입니다. " end found, node = search(dkey) if not found puts "없는 키에대한 삭제입니다 #{dkey}" return false end keys = node.keys if keys[ 0 ] == nil #leaf Node일때 node.delKey(dkey) @Root = nil if @Root .size() < 1 return true if ( not isUnder node) or nil == @Root # Under flow 처리 루틴 parent = node.parent # LEAF 노드 삭제 하는거 until parent == nil p_keys = parent.keys n_index = p_keys.index(node) if n_index != p_keys.size() - 1 #오른쪽 집에서 빌리기 neighbor = p_keys[n_index+ 2 ] if neighbor.size()- 1 > @M_WAY / 2 - 1 # 옆집이 부자면 right_loan(neighbor, parent, node) return true else # 옆집도 거지면 right_merge(neighbor, parent,node) grandson,parent ,node =node, parent.parent,parent return true if not isUnder node end else #왼쪽 집에서 빌리기 neighbor = p_keys[n_index- 2 ] # 오른쪽 집 없어서 왼쪽집 if neighbor.size()- 1 > @M_WAY / 2 - 1 # 왼쪽집 부자면 left_loan(neighbor, parent, node) return true else # 왼쪽집 거지면 left_merge(neighbor, parent,node) grandson, parent ,node = neighbor, parent.parent,parent return true if not isUnder node end end end #Root까지 왔을때 처리 하는거 if @Root .size < 1 @Root = grandson grandson.parent = nil end return true else # leaf node 가 아닐때 i=keys.index(dkey) p = keys[i+ 1 ] ch_node = p until p == nil ch_node = p ch_keys = p.keys p=ch_keys[ 0 ] end ckeys = ch_node.keys c_key = ckeys[ 1 ] delete(c_key) found, node = search(dkey) keys = node.keys i=keys.index(dkey) keys[i] = c_key return true end end end # end of B_Tree class |
'Sorce Bank' 카테고리의 다른 글
JOGL로 한 그래픽스 실습 <Lighitng> (0) | 2010.06.01 |
---|---|
그래픽스 : Solar System (0) | 2010.05.11 |
Python BST + AVL (0) | 2010.05.08 |
Python HW 2번문제 (0) | 2010.05.06 |
Python HW 1번문제 (0) | 2010.05.06 |
그래픽스 : Solar System
Sorce Bank 2010. 5. 11. 16:19
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | // SolarSystem.cpp : Defines the entry point for the console application. // //self rotation 자전 //orbiting 공전 /* * self rotation표현하기 위해 * rotation axis : +y (0,1,0) * rotation angle : 얼마나 돌았나 */ #define _USE_MATH_DEFINES #include <gl glut.h=""> #include <cmath> void init(); void display(); void idle(); void draw_axes(); void draw_cube(); float moon_selfrot_angle; float moon_radius,earth_radius ; float moon_orbit_angle,earth_selfrot_angle; float moon_orbit_raidus; float sun_radius,earth_orbit_raidus,earth_orbit_angle; void main( int argc, char * argv[]) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA); glutInitWindowPosition(100, 100); glutInitWindowSize(640, 640); glutCreateWindow( "GLUT tutorial" ); glutDisplayFunc(display); glutIdleFunc(idle); init(); glutMainLoop(); } void init() { glClearColor(1.0f, 1.0f, 1.0f, 1.0f); glEnable(GL_DEPTH_TEST); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f, 1.0f, 0.001f, 10000.0f); // don't care at this moment sun_radius=10.0f; earth_orbit_raidus=26.0f; earth_orbit_angle= 0.0f; moon_radius=0.7f; moon_selfrot_angle = 0.0f; moon_orbit_angle=0.0f; moon_orbit_raidus=3.5f; earth_radius=1.2f; earth_selfrot_angle=0.0f; } void display() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(50.0, 50.0, 50.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); draw_axes(); // DRAW the SUn glPushMatrix(); glScalef(sun_radius,sun_radius,sun_radius); glColor3f(1.0f,0.0f,0.0f); draw_cube(); glPopMatrix(); glTranslatef(earth_orbit_raidus* cos (2*M_PI*earth_orbit_angle/360),0.0f, earth_orbit_raidus* sin (2*M_PI*earth_orbit_angle/360)); glPushMatrix(); // 지구랑 달을 묶어서 위의 트렌스레이션을 하기위해 // 중괄호 같이 묶는다는 느낌. //지구 glPushMatrix(); ///////////////////////////////////// //현재 MV메트릭스를 저장하고 POP때 불러온다 // 이게 계층척 그래픽스의 핵심. 모델간의 계층관계를 표현하기 위해. // 기존의 I 메트릭스를 PUSH glRotatef(earth_selfrot_angle,0.5,0.5,0); glScalef(earth_radius,earth_radius,earth_radius); glColor3f(0.0f,1.0f,0.0f); draw_cube(); glPopMatrix(); /////////////////////////////////// // 기존의 pUSH 했던 I매트릭스를 pOP //dRAW THE MOON // 360 : 2*M_PI = Moon_orbit_angle : x ==> 2*M_PI*moon_orbit_angle/360 glTranslatef(moon_orbit_raidus* cos (2*M_PI*moon_orbit_angle/360),0.0f, moon_orbit_raidus* sin (2*M_PI*moon_orbit_angle/360)); glScalef(moon_radius,moon_radius,moon_radius); glColor3f(0.5f, 0.5f, 0.5f); glRotatef(moon_selfrot_angle,0,-1,0); draw_cube(); glPopMatrix(); glutSwapBuffers(); } void draw_axes() { glBegin(GL_LINES); // x axis glColor3f(0.2f, 0.2f, 0.2f); glVertex3f(-10.0f, 0.0f, 0.0f); glColor3f(1.0f, 0.0f, 0.0f); glVertex3f( 10.0f, 0.0f, 0.0f); // y axis glColor3f(0.2f, 0.2f, 0.2f); glVertex3f(0.0f, -10.0f, 0.0f); glColor3f(0.0f, 1.0f, 0.0f); glVertex3f(0.0f, 10.0f, 0.0f); // z axis glColor3f(0.2f, 0.2f, 0.2f); glVertex3f(0.0f, 0.0f, -10.0f); glColor3f(0.0f, 0.0f, 1.0f); glVertex3f(0.0f, 0.0f, 10.0f); glEnd(); } void draw_cube() { glBegin(GL_QUADS); // front glVertex3f( 0.5f, 0.5f, 0.5f); glVertex3f(-0.5f, 0.5f, 0.5f); glVertex3f(-0.5f, -0.5f, 0.5f); glVertex3f( 0.5f, -0.5f, 0.5f); // back glVertex3f( 0.5f, 0.5f, -0.5f); glVertex3f( 0.5f, -0.5f, -0.5f); glVertex3f(-0.5f, -0.5f, -0.5f); glVertex3f(-0.5f, 0.5f, -0.5f); // top glVertex3f( 0.5f, 0.5f, 0.5f); glVertex3f( 0.5f, 0.5f, -0.5f); glVertex3f(-0.5f, 0.5f, -0.5f); glVertex3f(-0.5f, 0.5f, 0.5f); // bottom glVertex3f( 0.5f, -0.5f, 0.5f); glVertex3f(-0.5f, -0.5f, 0.5f); glVertex3f(-0.5f, -0.5f, -0.5f); glVertex3f( 0.5f, -0.5f, -0.5f); // left glVertex3f(-0.5f, 0.5f, 0.5f); glVertex3f(-0.5f, 0.5f, -0.5f); glVertex3f(-0.5f, -0.5f, -0.5f); glVertex3f(-0.5f, -0.5f, 0.5f); // right glVertex3f( 0.5f, 0.5f, 0.5f); glVertex3f( 0.5f, -0.5f, 0.5f); glVertex3f( 0.5f, -0.5f, -0.5f); glVertex3f( 0.5f, 0.5f, -0.5f); glEnd(); } void idle() { // TODO: ... earth_orbit_angle+=0.01f; if (earth_orbit_angle > 360){ earth_orbit_angle = 0.0f; } moon_selfrot_angle+=0.01; //degree (도) if (moon_selfrot_angle > 360){ moon_selfrot_angle = 0.0f; } moon_orbit_angle+=0.04; // if (moon_orbit_angle > 360){ moon_orbit_angle= 0.0f; } earth_selfrot_angle+=0.06f; if (earth_selfrot_angle > 360) earth_selfrot_angle=0.0f; glutPostRedisplay(); } </cmath></gl> |
'Sorce Bank' 카테고리의 다른 글
JOGL로 한 그래픽스 실습 <Lighitng> (0) | 2010.06.01 |
---|---|
B-Tree (0) | 2010.05.15 |
Python BST + AVL (0) | 2010.05.08 |
Python HW 2번문제 (0) | 2010.05.06 |
Python HW 1번문제 (0) | 2010.05.06 |
Python BST + AVL
Sorce Bank 2010. 5. 8. 10:08
Tree.py
Node.py
BST.py
AVL.py
1 2 3 4 | class Tree: def __init__( self ): self .Root = None |
1 2 3 4 5 6 | class Node: def __init__( self ,key): self .key = key self .rightChild = self .leftChild = None |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | # -*- coding : ms949 -*- import Tree,Node import sys class BST: def search( self ,tree,s_key): if (tree = = None ): return None , None parent, curr = None ,tree.Root while (curr! = None ): if (curr.key = = s_key): break parent = curr if (curr.key > s_key): curr = curr.leftChild else : curr = curr.rightChild return parent,curr def inorder( self ,node): if (node = = None ): return self .inorder(node.leftChild) sys.stdout.write( str (node.key)) sys.stdout.write( "(" + str ( self .depth(node)) + ")" + " " ) self .inorder(node.rightChild) def depth( self ,node): if (node = = None ): return 0 ; elif (node.rightChild! = None and node.leftChild ! = None ): return 1 + max ( self .depth(node.rightChild), self .depth(node.leftChild)) elif (node.leftChild = = None ): return 1 + self .depth(node.rightChild) elif (node.rightChild = = None ): return 1 + self .depth(node.leftChild) else : return 1 def insert( self ,tree,new_key): q, p = self .search(tree, new_key) if (p ! = None ): print ( "Duplicate key error" ) return False newNode = Node.Node(new_key) if (tree.Root = = None ): tree.Root = newNode elif (new_key < q.key): q.leftChild = newNode else : q.rightChild = newNode return True def delete( self ,tree, d_key): q, p = self .search(tree, d_key) if (p = = None ): print ( "There are no key to delete." ) return False if (p.leftChild = = None and p.rightChild = = None ): if (q = = None ): tree.Root = None return True if (q.leftChild = = p): q.leftChild = None else : q.rightChild = None elif (p.leftChild! = None and p.rightChild! = None ): if ( self .depth(p.leftChild) > self .depth(p.rightChild)): # Depth of leftSubTree is larger than Right exchangeNode = p.leftChild while (exchangeNode.rightChild! = None ): exchangeNode = exchangeNode.rightChild else : # Depth of rightSubTree is larger than Left exchangeNode = p.rightChild while (exchangeNode.leftChild! = None ): exchangeNode = exchangeNode.leftChild self .delete(tree, exchangeNode.key) p.key,exchangeNode.key = exchangeNode.key,p.key elif (p.leftChild! = None ): if (q.leftChild = = p): q.leftChild = p.leftChild else : q.rightChild = p.leftChild else : if (q.leftChild = = p): q.leftChild = p.rightChild else : q.rightChild = p.rightChild return True |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | # -*- coding: ms949 -*- import BST import sys class AVL(BST.BST): def __init__( self ): self .bf_stack = [] self .node_stack = [] def BFof( self ,node): return self .depth(node.leftChild) - self .depth(node.rightChild) def insert( self ,tree,key): if super (AVL, self ).insert(tree,key) = = False : return False if self .isAVL(tree,key) : del self .bf_stack[:] del self .node_stack[:] else : self .makeAVL(tree,key) return True def delete( self ,tree,key): if super (AVL, self ).delete(tree, key) = = False : return False if self .isAVL(tree,key) : del self .bf_stack[:] del self .node_stack[:] else : self .makeAVL(tree,key) return True def isAVL( self ,tree,key): parent,gabage = self .search(tree, key) if parent = = None : return True if len ( self .bf_stack) = = 3 : self .bf_stack.remove( self .bf_stack[ 0 ]) self .node_stack.remove( self .node_stack[ 0 ]) bf = self .BFof(parent) self .bf_stack.append(bf) self .node_stack.append(parent) if ( abs (bf)> 1 ): return False return self .isAVL(tree,parent.key) def makeAVL( self ,tree,key): if ( len ( self .bf_stack) = = 2 ): gabage,C = self .search(tree,key) self .node_stack.insert( 0 ,C) self .bf_stack.insert( 0 , self .BFof(C)) if len ( self .bf_stack) = = 3 : if self .bf_stack[ 1 ] < 0 and self .bf_stack[ 2 ] > 0 : print ( "insert" , str (key), "=> LR" ) self .RL_LR(tree, self .node_stack[ 1 ], self .node_stack[ 2 ]) elif self .bf_stack[ 1 ] > 0 and self .bf_stack[ 2 ] < 0 : print ( "insert" , str (key), "=> RL" ) self .RL_LR(tree, self .node_stack[ 2 ], self .node_stack[ 1 ]) elif self .bf_stack[ 1 ] * self .bf_stack[ 2 ] > 0 : sys.stdout.write( "insert " + str (key)) self .node_stack.remove( self .node_stack[ 0 ]) self .LL_RR(tree) del self .bf_stack[:] del self .node_stack[:] def LL_RR( self ,tree): A,B = self .node_stack[ 1 ], self .node_stack[ 0 ] parent,gabage = self .search(tree,A.key) if parent = = None : tree.Root = B elif parent.leftChild = = A: parent.leftChild = B else : parent.rightChild = B if self .bf_stack[ 1 ] > 0 and self .bf_stack[ 2 ] > 0 : A.leftChild,B.rightChild = B.rightChild, A print ( " => LL" ) elif self .bf_stack[ 1 ] < 0 and self .bf_stack[ 2 ] < 0 : A.rightChild,B.leftChild = B.leftChild, A print ( " => RR" ) def RL_LR( self ,tree,left,right): parent,gabage = self .search(tree, self .node_stack[ 2 ].key) C = self .node_stack[ 0 ] if parent = = None : tree.Root = C elif parent.leftChild = = self .node_stack[ 2 ]: parent.leftChild = C else : parent.rightChild = C C.leftChild,C.rightChild,left.rightChild,right.leftChild = left,right ,C.leftChild,C.rightChild |
'Sorce Bank' 카테고리의 다른 글
B-Tree (0) | 2010.05.15 |
---|---|
그래픽스 : Solar System (0) | 2010.05.11 |
Python HW 2번문제 (0) | 2010.05.06 |
Python HW 1번문제 (0) | 2010.05.06 |
그래픽스 실습 4.27 (0) | 2010.04.27 |
Python HW 2번문제
Sorce Bank 2010. 5. 6. 00:06
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | import os.path import glob import sys if ( len (sys.argv)! = 2 ): print ( "Usage : python <Script name> <Dir Name>" ) sys.exit( 1 ) class Du: def searchDir( self ,dirName): fileList = glob.glob(dirName) size = 0 ; for fullFile in fileList: if os.path.isdir(fullFile): size + = self .searchDir(fullFile + "/*" ) else : s = os.path.getsize(fullFile) size + = s print size / 1024 ,dirName return size test = Du() test.searchDir(sys.argv[ 1 ] + "/*" ) |
'Sorce Bank' 카테고리의 다른 글
그래픽스 : Solar System (0) | 2010.05.11 |
---|---|
Python BST + AVL (0) | 2010.05.08 |
Python HW 1번문제 (0) | 2010.05.06 |
그래픽스 실습 4.27 (0) | 2010.04.27 |
파이썬 c API 하다 만거 (0) | 2010.04.15 |