# Data Structures
- Data Structure
- A data structure is a format to store, manage and organize data in such a way that enables efficient data access and data modification.
- ADT abstract data type
- is a mathematical model for data types.
Different types of data structures are suited to different kinds of applications, and some are highly specialized to specific tasks.
Choice of data- structure selection to attack a problem seperates pros from mediocre porgrammers
ADT can themselves be implemented in a variety of ways
Abstraction ADT | Implementation DS |
---|---|
List | Dynamic Array Linked list |
Queue | linked list using Arrays stack based |
Map | Tree map Hash Map Hash Table |
Vehicle | Golf cart Bicycle Smart car |
# Some examples,
- Relational databases commonly use B-tree indexes for data retrieval
- while compiler implementations usually use hash tables to look up identifiers.
Usually, efficient data structures are key to designing efficient algorithms.
Abstraction levels on data
Data structures are generally based on the ability of a computer to fetch and store data at any place in its memory, specified by a pointer—a bit string, representing a memory address, that can be itself stored in memory and manipulated by the program
# Data structure Types
There are numerous types of data structures, generally built upon simpler primitive data types:
- Linear data Structures
- can be traversed in singled run
- Examples
- Arrays
- Stacks
- LIFO
- FIFO
- Queues
- Non Linear data structures
- cannot be traversed in single run
- Examples
- Trees
- Graphs
- Linked lists
- sequence of nodes
- Dynamic Data structures
- Grow and shrink at run-time
- What are Binary trees
- Binary Heaps
- Linear Search
- Binary Search
- Divide and conquer
- Linear Sort
- Difference between stacks and Queues
- What are recursive algorithms
- Sorting algorithms
- Merge Sort
- Heap vs Tree and Stack , Advantages and disadvantages
# Spanning Tree
- Operations
- Tree generations
- Tree traversal
- in-order
- preorder
- post-order
- Tree searching
- Tree modification
- Node deletion
- Balancing tree
- Heaps
- max heap
- min heap
- Operations
- insertion
- self-balancing
- removal - pop from the root
- Sorting
- Heapify
- Priority Queue
# Some good Questions
- Are Data-Structure and Algorithm same for all programming languages?
- Is there a difference between 'data structure' and 'data type'?
Major Takeaways before you leave
- What are Data Structures?
- Why are they important?
- What is the point of data structure?