Data structure Flashcards
Arrays
A data structure that stores a collection of items at contiguous memory locations.
Array
Fixed size, elements accessed by index, efficient for random access.
- Example: int[] numbers = {1, 2, 3, 4, 5}
Linked Lists
Definition: A data structure consisting of a sequence of elements, each pointing to the next
Linked list
-Dynamic size, elements accessed sequentially, efficient for insertion/deletion.
- Types: Singly linked list, doubly linked list.
Stacks**:
- Definition: A data structure that follows the Last In, First Out (LIFO) principle.
- Operations: Push (add element), Pop (remove top element), Peek (view top element).
- Example: Function call stack.