Câu hỏi phỏng vấn Data Structures
Câu hỏi

Define Stack

Câu trả lời

What is a Stack?

A stack is a fundamental data structure in computer science that follows the Last-In-First-Out (LIFO) principle. It is a collection of elements where the addition and removal of elements happen at one end, known as the "top" of the stack.

The key characteristics of a stack are:

LIFO (Last-In-First-Out) Principle

The last element added to the stack is the first one to be removed. This means that the most recently added item is the first one to be accessed or removed.

Operations

The main operations performed on a stack are:

  1. Push: Adds an element to the top of the stack.
  2. Pop: Removes and returns the top element from the stack.
  3. Peek: Returns the top element of the stack without removing it.
  4. IsEmpty: Checks if the stack is empty (has no elements).

Applications of Stacks

Stacks have a wide range of applications in computer...

entry

entry

Gợi ý câu hỏi phỏng vấn

middle

Compare Heaps vs Arrays to implement Priority Queue

entry

Define Linked Lis

middle

What is an Associative Array?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào