Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

1.1-3

Select a data structure that you have seen, and discuss its strengths and limitations.

Solution

The chosen data structure is a Stack, which is a data structure that follows the LIFO (Last In First Out) principle. The main operations of a stack are push and pop.

Strengths:

  • It's very easy to implement
  • Operations all have a time complexity of O(1) (constant)
  • Can be used to perform powerful operations

Limitations:

  • It's not very flexible, it's not possible to access elements in the middle of the stack
  • It's not possible to search it quickly (O(n) time complexity)
  • Deleting a particular item from the stack is also not quick (O(n) time complexity)