강의

멘토링

커뮤니티

Inflearn Community Q&A

pjh098909890926's profile image
pjh098909890926

asked

Introduction to Python Algorithm Problem Solving (Coding Test Preparation)

3. Creating a postfix notation: infix-->postfix (stack)

괄호 안에 연산자들에 우선순위가 있는 경우엔 어떡하나요?

Written on

·

279

0

예를들어 괄호안에 * 가 + 보다 먼저오는경우

(3*6+8)+3/2

괄호안의 연산자들이  ')'를 만났을 때 순서대로 pop되면 안될거 같은데 어떻게 처리해줘야 하나요?

python코테 준비 같이 해요!

Answer 1

0

codingcamp님의 프로필 이미지
codingcamp
Instructor

안녕하세요^^

괄호밖의 연산자건 괄호안의 연산자건 연산자를 만나면 스택의 상단과 우선순위를 비교합니다. 영상 7분 50초 경부터 보시고 또 코드구현하는 16분 30초 경부터도 보세요. 그리고 제가 드린 소스코드로 위 예를 출력해보고 분석해보세요.

pjh098909890926's profile image
pjh098909890926

asked

Ask a question