0
0
Data Structures Theoryknowledge~10 mins

Abstract Data Type vs Data Structure in Data Structures Theory - Visual Side-by-Side Comparison

Choose your learning style9 modes available
Concept Flow - Abstract Data Type vs Data Structure
Start
Define Abstract Data Type (ADT)
Specify operations and behavior
Implement with Data Structure
Data Structure stores data physically
Use ADT operations on Data Structure
End
This flow shows how an Abstract Data Type defines what operations are needed, and a Data Structure provides the actual way to store and organize data to support those operations.
Execution Sample
Data Structures Theory
ADT: List
Operations: add(item), remove(item), get(index)

Data Structure: Array
Stores items in order
Supports ADT operations by index
Defines a List ADT with operations, then uses an Array data structure to store items and perform those operations.
Analysis Table
StepActionADT OperationData Structure StateResult/Output
1Create empty List ADTN/AArray: []Empty list ready
2Add 'apple'add('apple')Array: ['apple']Item added
3Add 'banana'add('banana')Array: ['apple', 'banana']Item added
4Get item at index 1get(1)Array: ['apple', 'banana']'banana' returned
5Remove 'apple'remove('apple')Array: ['banana']Item removed
6Get item at index 0get(0)Array: ['banana']'banana' returned
7Remove 'orange'remove('orange')Array: ['banana']Item not found, no change
8EndN/AArray: ['banana']Final state
💡 All ADT operations performed; data structure reflects changes.
State Tracker
VariableStartAfter 2After 3After 5After 7Final
Array[]['apple']['apple', 'banana']['banana']['banana']['banana']
Key Insights - 3 Insights
Why do we say ADT defines behavior but not storage?
Because ADT specifies what operations can be done (see execution_table steps 2-6) but does not say how data is stored; the Array data structure handles storage.
Can different data structures implement the same ADT?
Yes, for example, a List ADT can be implemented with an Array (shown here) or a Linked List, both supporting the same operations but storing data differently.
What happens if we try to remove an item not in the data structure?
As in step 7 of execution_table, the remove operation finds no item and leaves the data structure unchanged.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table at step 4, what item is returned by get(1)?
A'apple'
B'orange'
C'banana'
DError
💡 Hint
Check the Data Structure State column at step 4 to see the array contents.
At which step does the data structure first contain only one item?
AStep 5
BStep 3
CStep 7
DStep 2
💡 Hint
Look at the Array contents in the Data Structure State column for each step.
If we used a Linked List instead of an Array, which part of the execution_table would change?
AADT Operation column
BData Structure State column
CResult/Output column
DStep numbers
💡 Hint
Consider how the physical storage is represented in the Data Structure State column.
Concept Snapshot
Abstract Data Type (ADT): Defines what operations are possible and their behavior.
Data Structure: The actual way data is stored and organized to support ADT operations.
ADT is about 'what', Data Structure is about 'how'.
Multiple data structures can implement the same ADT.
Example: List ADT can be implemented by Array or Linked List.
Operations on ADT affect the underlying data structure state.
Full Transcript
This visual execution shows the difference between Abstract Data Type (ADT) and Data Structure. The ADT defines the operations like add, remove, and get without specifying how data is stored. The Data Structure, such as an Array, physically stores the data and supports these operations. Step by step, items are added, retrieved, and removed from the Array, reflecting the ADT operations. The execution table tracks these changes clearly. Key points include understanding that ADT is about behavior and Data Structure is about storage. Different data structures can implement the same ADT. The quiz questions help reinforce these ideas by referencing the execution steps and variable states.