All Honey Tip

[태그:] LIFO

  • [기술 면접] 5. Stack은 어떤 자료구조인가요?

    [기술 면접] 5. Stack은 어떤 자료구조인가요?

    수정 일:

    발행 일:

    저번 시간에 이어, 이번에는 스택(Stack) 자료구조에 대해 알아보겠습니다. Stack은 Queue와 비교되며 나오는 개념이긴 하지만, Queue에 비해 상대적으로 적게 나오는 편입니다. 중요하긴 해도 Queue만큼의 질문 범위가 넓진 않다고 할 수 있죠. 어렵지 않으니 간단하게 알아보고 넘어가도록 합시다. Q: Stack은 어떤 자료구조인가요? 후입선출 LIFO(Last In First Out)의 자료구조입니다. push, pop 모두 O(1)의 시간복잡도를 가지며 후위 표기법 연산,…

  • [Coding Test] 1. Binary Gap

    [Coding Test] 1. Binary Gap

    1. Binary Gap 문제 A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N. For example, number 9 has binary representation 1001 and contains a binary gap of length 2. The number 529 has binary representation 1000010001 and contains two binary gaps:…