Skip to content

emmarcaber/Python-Algorithm-Techniques

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Python Algorithm Techniques

Embark on a captivating journey into the realm of Python algorithm techniques, where the synergy between powerful problem-solving methodologies and Python's elegance takes center stage.

Techniques

These techniques leverage Python's concise syntax and extensive libraries to implement algorithms ranging from elementary sorting and searching to intricate graph traversal and dynamic programming. Through this fusion, programmers gain the ability to devise efficient solutions to complex problems while harnessing Python's versatility and readability.

1. Sliding Window

Usage:

This algorithmic technique is used when we need to handle the input data in a specific window size. 

DS Involved:

Array, String, Hashtable

Sample Problems:

- Longest Substring with 'k' Distinct Characters
- Fruits into Baskets

2. Islands (Matrix Traversal)

Usage:

This pattern describes all the efficient ways of traversing a matrix (or 2D array).

DS Involved:

Matrix, Queue

Sample Problems:

- Number of Islands
- Flood Fill
- Cycle in a Matrix

3. Two Pointers

Usage:

This technique uses two pointers to iterate input data. Generally, both pointers move in the opposite direction at a constant interval.

DS Involved:

Array, String, Linked List

Sample Problems:

- Squaring a Sorted Array
- Dutch National Flag Problems
- Minimum Window Sort

4. Fast and Slow Pointers

Usage:

Also known as Hare & Tortoise algorithm. This technique uses two pointers that traverse the input data at different speeds.

DS Involved:

Array, String, Linked List

Sample Problems:

- Middle of the Linked List
- Happy Number
- Cycle in a Circular Array

5. Merge Intervals

Usage:

This technique is used to deal with overlapping intervals.

DS Involved:

Array, Heap

Sample Problems:

- Conflicting Appointments
- Minimum Meeting Rooms

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages