Here's a detailed study set for your data structures class based on your worksheets and requested topics:
Data Structures Study Set
Fundamentals
Data Structure: A systematic way of organizing and accessing data.
Algorithm: A generic step-by-step set of instructions for solving a problem.
Program: An implementation of an algorithm in code.
Abstract Data Types (ADTs)
Big O Notation
Python Object-Oriented Concepts
Inheritance: A class can inherit attributes and methods from another class.
Constructor (__init__
): A special function that initializes an object.
Import: Brings in external modules to use functions or classes.
Functions: Blocks of reusable code that perform a task.
Access Control:
Public attributes (self.attribute
): Accessible from anywhere.
Protected attributes (self._attribute
): Conventionally private but still accessible.
Private attributes (self.__attribute
): Name-mangled to prevent direct access.
__str__
Method: Defines how an object is represented as a string.
Naming Conventions: Use snake_case
for variables/functions and PascalCase
for class names.
self
Keyword: Refers to the instance of the class.
Stack (LIFO - Last In, First Out)
Functions:
push(item)
: Adds an item to the top.
pop()
: Removes and returns the top item.
peek()
: Returns the top item without removing it.
size()
: Returns the number of elements.
is_empty()
: Returns True
if stack is empty.
Queue (FIFO - First In, First Out)
Functions:
enqueue(item)
: Adds an item to the back.
dequeue()
: Removes and returns the front item.
size()
: Returns the number of elements.
is_empty()
: Returns True
if queue is empty.
Deque (Double-Ended Queue)
Functions:
add_front(item)
: Adds an item to the front.
add_rear(item)
: Adds an item to the back.
remove_front()
: Removes and returns the front item.
remove_rear()
: Removes and returns the back item.
size()
: Returns the number of elements.
is_empty()
: Returns True
if deque is empty.
Node (Basic Building Block for Linked Structures)
Let me know if you need any modifications or explanations! 😊