VS Code 설정 및 HTML, CSS 입문
Stack 클래스 사용
스택을 사용했던 괄호 문제와 로직이 흡사함. 괄호 종류가 추가되어서 조건을 추가해줘야 함.
PriorityQueue 클래스 사용
우선순위 큐 자료구조를 잘 모르는 상태에서 PriorityQueue
클래스 메서드를 사용하기 위해 자료조사
source: https://cs.lmu.edu/~ray/notes/pqueues/
Heaps
A heap is a complete binary tree in which the value of a node is less than all the values in its subtrees. By convention, the smallest element is the one with the highest priority.
PriorityQueue is a specific use case of a Heap, which in turn is a specific use case of a BinaryTree
PriorityQueue Hierarchy
A priority queue in Java is a special type of queue wherein all the elements are ordered as per their natural ordering or based on a custom
Comparator
supplied at the time of creation.
A
Comparator
interface in Java helps you define how objects should be compared and sorted based on specific criteria, allowing you to customize the sorting behavior of Java's built-in sorting methods.
source: Googling Based on chatGPT's response(There could be some errors)
1강 수강완료
조금 더 고민해서 스스로 풀 수도 있었을 텐데 조건문 로직을 검색하다가 알게 되어 아쉬웠음. 한편 팀원으로부터 stack.clear()
메서드를 사용하면 스택을 루프마다 매번 생성하지 않아도 된다는 것을 알게 됨.
Comparator
인터페이스를 구현하는 대신 Collections.reverseOrder()
메서드를 사용하여 큐를 내림차순으로 설정하였다.
PriorityQueue<Integer> pq = new PriorityQueue<>(Collections.reverseOrder());
자료구조 지식이 부족하다는 점을 느꼈다. 스파르타 강의실에 자료구조 강의도 있는데 시간을 내서 들어야겠다.