분류 전체보기(324)
-
Jsp Cookie ( 쿠키생성, 쿠키변경, 쿠키삭제 , 쿠키인코딩 )
쿠키(Cookie) 1.개념 - 웹 브라우저가 보관하고 있는 데이터로, 웹 서버에요청을 보낼때 쿠키를 헤더에 담아 전송한다.- 웹 브라우저는 쿠키가 삭제되기 전까지 웹 서버에 쿠키를 전송한다. 2.동작방식 - 쿠키 생성 : 웹 서버에서 쿠키를 생성하고 쿠키에 응답데이터를 담아서 웹 브라우저에 전송한다.- 쿠키 저장 : 웹 브라우저는 응답 데이터를 담고있는 쿠키를 메모리나 파일로 저장한다.- 쿠키 전송 : 웹 브라우저는 쿠키를 요청이 있을 때마다 웹서버에 전송한다.웹 서버는 쿠키를 사용해서 필요한 작업을 수행 할 수 있다. 3.생성방식 1) 쿠키를 생성하고 response객체에 담는다. Cookie cookie = new Cookie( "cookieName" , "cookieValue" );response..
2017.04.08 -
Queue Put / Get
큐는 배열형태로 사용하는 것이 링크드리스트를 사용하는 것보다 쉽고 편리하다. Queue 는 First In First Out 으로 먼저 들어간 것이 먼저 나오는 형태 int Queue[100]; // 배열선언 int front = 0 , rear = 0 ; void Put( int num ){ Queue[rear] = num ;rear++; if ( rear >= 100 ){rear = 0 ;}} int Get(void){int result = 0;result = Queue[front];front++; if( front >= 100 ){front = 0 ;} return result ;} int main ( void ) { put( 1 );put( 3 );put( 5 ); get()..
2017.04.07 -
스택 ( Stack push함수 , Stack pop함수 )
스택알고리즘1. 푸시( push )- 데이터를 순서를 적용해 차례로 저장한다.2. 팝( pop )- 가장 최신 데이터부터 차레로 가져온다. typedef struct _Node{ // 구조체 선언int Data;struct _Node* Next;} Node; void InitializeStack(void){ // stack 초기화head = (Node*)malloc(sizeof(Node));end = (Node*)malloc(sizeof(Node));head->Next = end ;end->Next = end ;} // push함수void push( int num ){Node* ptr = (Node*)malloc(sizeof(Node)); ptr->data = num ; // 스택에 num 저장ptr->..
2017.04.06 -
링크드리스트 ( Linked List )
#include#includetypedef struct _Node { // 구조체선언char Data;struct _Node *Next} Node;Node *head , *end , *temp;Node *temp1 , *temp2 , *temp3 , *temp4 ; void Initialize(void){ // 단일 링크드 리스트 생성함수Node *p ;head = (Node*)malloc(sizeof(Node));end = (Node*)malloc(sizeof(Node)); temp1 = (Node*)malloc(sizeof(Node));temp1->Data = 'A';head->Next = temp1;temp1->Next = end;end->Next = end;p = tem..
2017.04.05 -
삽입정렬(InsertSort) & 버블정렬(BubbleSort)
1. 삽입정렬 ( InsertSort ) 원리 : 선택한 요소가 들어갈 있는 자리를 찾아서 삽입시킨다. #includevoid insert_sort ( int arr[] , int end ) { int i = 0 , j = 0 , temp = 0 ; for( int i = 0 ; i temp && j > 0 ){ arr [ j ] = arr [ j-1 ];j--;}arr [ j ] = temp ;}} int main ( void ){int arr[] = { 5 , 4 , 2 , 3 , 1 };int i = 0 ;insert_sort( arr , 4 );for ( i = 0 ; i i , j = 0 : 5 4 ..
2017.03.27 -
Fibonacci & Dynamic Programming( 피보나치수열 & 동적계획법)
피보나치수열 과 동적계획법 원리 : n번째 수 = n-1번째 수 + n-2번째 수 0 , 1 , 1 , 2 , 3 , 5 , 8 ... #includeint fibonacci ( n ) { if ( n == 0 ) { return 0 ;}else if ( n == 1 ){return 1;}else {return fibonacci( n - 1 ) + fibonacci( n - 2 ) ;}} int main( void ) { int n = 0 ;int result = 0;scanf( "%d" , &n ); result = fibonacci ( n ) ; printf("%d\n" , result ); return 0;} ------- 위 알고리즘은 똑같은 식을 계산하는 불필요한 과..
2017.03.25