Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- jar war
- MySQL
- mysql 문자열 연결
- mysql concat
- mybatis dtd
- 스프링부트
- 알고리즘
- java 객체지향
- SQL
- mysql 날짜
- 뷰 테이블
- mybatis
- mybatis 상단 태그
- 자바 참조형
- Java
- <?xml version="1.0" encoding="utf-8"?> <!doctype mapper public "-//mybatis.org//dtd mapper 3.0//en" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- 객체 절차
- mybatis 태그
- cupucharm
- <!doctype mapper public "-//mybatis.org//dtd mapper 3.0//en" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- 협업툴
- sql 가상 테이블
- <?xml version="1.0" encoding="utf-8"?>
- leetcode 1484
- SpringBoot
- 뷰 사용하는 이유
- mybatis 매퍼
- 자바
- 리액트
- group_concat concat
Archives
- Today
- Total
glog : cupucharm
[Java] Stack 본문
LIFO 형태 : 나중에 들어간 것이 먼저 나오는 구조 (후입선출)
특징
- 시스템 해킹에서 버퍼 오버플로우 취약점을 이용한 공격을 할 때 스택 메모리의 영역에서 함
- 인터럽트 처리, 수식의 계산, 서브루틴의 복귀 번지 저장 등에 쓰임
- 그래프의 깊이 우선 탐색(DFS)에서 사용
- 재귀적 함수를 호출할 때 사용
Stack 사용법
Stack 선언
import java.util.Stack;
Stack<Integer> stack = new Stack<>();
Stack<String> stack = new Stack<>();
Stack 값 추가
Stack<Integer> stack = new Stack<>();
stack.push(1);
stack.push(2);
stack.push(3);
push(value) 메소드 사용
Stack 값 삭제
Stack<Integer> stack = new Stack<>();
stack.push(1);
stack.push(2);
stack.push(3);
stack.pop(); //stack에 값 제거
stack.clear(); //stack의 전체 값 제거 (초기화)
pop() 메서드 사용
Stack의 가장 상단의 값 출력
Stack<Integer> stack = new Stack<>();
stack.push(1);
stack.push(2);
stack.push(3);
stack.peek(); //stack의 가장 상단의 값 출력
peek() 메서드 이용
Stack의 기타 메서드
Stack<Integer> stack = new Stack<>();
stack.push(1);
stack.push(2);
stack.size(); //stack의 크기 출력 : 2
stack.empty(); //stack이 비어있는지 (비어있다면 true)
stack.contains(1); //stack에 1이 있는지 (있다면 true)
특징
- 시스템 해킹에서 버퍼 오버플로우 취약점을 이용한 공격을 할 때 스택 메모리의 영역에서 함
- 인터럽트 처리, 수식의 계산, 서브루틴의 복귀 번지 저장 등에 쓰임
- 그래프의 깊이 우선 탐색(DFS)에서 사용
- 재귀적 함수를 호출할 때 사용
Stack 사용법
Stack 선언
import java.util.Stack;
Stack<Integer> stack = new Stack<>();
Stack<String> stack = new Stack<>();
Stack 값 추가
Stack<Integer> stack = new Stack<>();
stack.push(1);
stack.push(2);
stack.push(3);
push(value) 메소드 사용
Stack 값 삭제
Stack<Integer> stack = new Stack<>();
stack.push(1);
stack.push(2);
stack.push(3);
stack.pop(); //stack에 값 제거
stack.clear(); //stack의 전체 값 제거 (초기화)
pop() 메서드 사용
Stack의 가장 상단의 값 출력
Stack<Integer> stack = new Stack<>();
stack.push(1);
stack.push(2);
stack.push(3);
stack.peek(); //stack의 가장 상단의 값 출력
peek() 메서드 이용
Stack의 기타 메서드
Stack<Integer> stack = new Stack<>();
stack.push(1);
stack.push(2);
stack.size(); //stack의 크기 출력 : 2
stack.empty(); //stack이 비어있는지 (비어있다면 true)
stack.contains(1); //stack에 1이 있는지 (있다면 true)
특징
- 시스템 해킹에서 버퍼 오버플로우 취약점을 이용한 공격을 할 때 스택 메모리의 영역에서 함
- 인터럽트 처리, 수식의 계산, 서브루틴의 복귀 번지 저장 등에 쓰임
- 그래프의 깊이 우선 탐색(DFS)에서 사용
- 재귀적 함수를 호출할 때 사용
Stack 사용법
Stack 선언
import java.util.Stack;
Stack<Integer> stack = new Stack<>();
Stack<String> stack = new Stack<>();
Stack 값 추가
Stack<Integer> stack = new Stack<>();
stack.push(1);
stack.push(2);
stack.push(3);
push(value) 메소드 사용
Stack 값 삭제
Stack<Integer> stack = new Stack<>();
stack.push(1);
stack.push(2);
stack.push(3);
stack.pop(); //stack에 값 제거
stack.clear(); //stack의 전체 값 제거 (초기화)
pop() 메서드 사용
Stack의 가장 상단의 값 출력
Stack<Integer> stack = new Stack<>();
stack.push(1);
stack.push(2);
stack.push(3);
stack.peek(); //stack의 가장 상단의 값 출력
peek() 메서드 이용
Stack의 기타 메서드
Stack<Integer> stack = new Stack<>();
stack.push(1);
stack.push(2);
stack.size(); //stack의 크기 출력 : 2
stack.empty(); //stack이 비어있는지 (비어있다면 true)
stack.contains(1); //stack에 1이 있는지 (있다면 true)
특징
- 시스템 해킹에서 버퍼 오버플로우 취약점을 이용한 공격을 할 때 스택 메모리의 영역에서 함
- 인터럽트 처리, 수식의 계산, 서브루틴의 복귀 번지 저장 등에 쓰임
- 그래프의 깊이 우선 탐색(DFS)에서 사용
- 재귀적 함수를 호출할 때 사용
Stack 사용법
Stack 선언
import java.util.Stack;
Stack<Integer> stack = new Stack<>();
Stack<String> stack = new Stack<>();
Stack 값 추가
Stack<Integer> stack = new Stack<>();
stack.push(1);
stack.push(2);
stack.push(3);
push(value) 메소드 사용
Stack 값 삭제
Stack<Integer> stack = new Stack<>();
stack.push(1);
stack.push(2);
stack.push(3);
stack.pop(); //stack에 값 제거
stack.clear(); //stack의 전체 값 제거 (초기화)
pop() 메서드 사용
Stack의 가장 상단의 값 출력
Stack<Integer> stack = new Stack<>();
stack.push(1);
stack.push(2);
stack.push(3);
stack.peek(); //stack의 가장 상단의 값 출력
peek() 메서드 이용
Stack의 기타 메서드
Stack<Integer> stack = new Stack<>();
stack.push(1);
stack.push(2);
stack.size(); //stack의 크기 출력 : 2
stack.empty(); //stack이 비어있는지 (비어있다면 true)
stack.contains(1); //stack에 1이 있는지 (있다면 true)
'java > 자료구조' 카테고리의 다른 글
[Java] Queue (4) | 2023.02.03 |
---|