Data Structures:
-
Keep related info together to find the data in an efficent way
-
Collections of information
-
Haphazard is imaginary ; it is an intentional management of data
-
Held in memory inside the running application
-
Systematic arrangement of some values together
- Multiple repeating items as different transactions
- Use of the idea of tuple to generate a group for similar data
-
C styled struct:
- No behavior only data
- Simple creation
- Value types unlike objects which are passed as reference
- No features of oop
Requirements of any data structures:
- How to find (can be a single or multiple items at once)
- How to insert (where to insert the data) [INSERT OR PUSH]
- How to delete (from end or from top and how by copying into a new array or dynamic shuffling) [REMOVE OR POP]
- How to find (if it exists or where it exists)
- How to sort (sort in place or create new sorted version)
- Staying conscious of the data, how much, how many the data is going to alter
Summary
- Arrays: Direct indexing, easy to create and use Weak: Sort, Search and insertion
- Linked list: Insertion and iteration is better; Weak: Direct search and sort
- Stacks and Queues: LIFO OR FIFO Weak: DIrect access, Searching and sorting
- Hash table: Speed of insertion and deletion, Access speed Weak: Retrieving in a sorted order, Search for a value
- Sets: Check exists(), Avoid duplicates