자료구조
-
[문제해설] 다음 수식 A/B*(C-D)+E 을 Postfix로 표현하시오.전자계산기조직응용기사/실기 필답형 기출문제 해설 2022. 5. 3. 09:23
전자계산기조직응용기사 실기 필답형 기출문제 (수식 표기법) - 2020년1회 2회 통합 다음 수식 A/B*(C-D)+E 을 Postfix로 표현하시오. - 문제해설 - "본 해설은 기사 등급의 수준을 훨씬 넘으므로, 기술사 취득에 관심 있으신 분께 권장하는 해설입니다." 우리(human)는 일반적으로 수식을 표현할 때 중위 표기법(infix notation)을 사용합니다. 하지만, 컴파일러는 그렇지 못합니다. 대신 컴파일러는 후위 표기(postfix)라고 하는 괄호를 사용하지 않는 표기법을 일반적으로 사용합니다. 다음 표에서는 중위 표기와 후위 표기에 대한 예시를 보여줍니다. 중위 표기 후위 표기 2 + 3 * 4 2 3 4 * + a * b + 5 ab*5+ ( 1 + 2 ) * 7 1 2 + 7 * ..
-
[문제해설] 스택 S에서 B, A, D, C를 순서대로 입력시킬 때, 출력을 A, B, C, D 순으로 하기 위한 push와 pop의 횟수는?전자계산기조직응용기사/필기 기출문제 해설 2021. 10. 23. 09:10
전자계산기조직응용기사 필기 기출문제 해설(2과목 자료구조 및 데이터통신-스택) - 2019년1회 스택 S에서 B, A, D, C를 순서대로 입력시킬 때, 출력을 A, B, C, D 순으로 하기 위한 push와 pop의 횟수는? ① push : 4, pop : 4 ② push : 3, pop : 5 ③ push : 2, pop : 6 ④ push : 5, pop : 3 -문제 해설- 스택(stack)은 자료구조의 선형구조 중에서 리스트의 한쪽 끝으로만 자료의 삽입, 삭제 작업이 이루어지는 구조입니다. 단어 자체가 '쌓다'라는 뜻이듯, 동전을 쌓을 때, 동전을 하나씩 올리는 것을 입력, 맨 위에 것을 하나씩 들어내는 것을 상상하시면 됩니다.(중간에 있는 동전을 빼낼 수 없다는 가정) 컴퓨터 구조에서는 서브루..