Data Structure Uses Flashcards

1
Q

Array

A
  • Use when you need constant-time random access to elements.
    • Suitable for situations where the size of the data is fixed or known in advance.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

ArrayList

A
  • Similar to an array, but provides dynamic resizing.
    • Use when you need a resizable array with constant-time random access.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

LinkedList

A
  • Use when you frequently insert or delete elements from the middle of the list.
    • Good for situations where sequential access is more common than random access.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Stack

A
  • Use when you need Last In, First Out (LIFO) access pattern.
    • Useful for managing function calls, undo/redo functionality, and parsing expressions.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Queue

A
  • Use when you need First In, First Out (FIFO) access pattern.
    • Suitable for tasks like managing tasks in a printer queue, breadth-first search, etc.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Binary Trees

A
  • Use for hierarchical data representation.
    • Suitable for scenarios where you need efficient searching, insertion, and deletion operations.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

HashSet

A
  • Use when you need constant-time average complexity for basic operations (add, remove, contains).
    • Good for scenarios where you want to check for the presence of an element without duplicates.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Heap

A
  • Use when you need quick access to the maximum or minimum element.
    • Often used in priority queue implementations, where the highest (or lowest) priority element needs to be retrieved quickly.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly