/Handy-Algorithms

Some handy algorithms

Primary LanguagePython

Handy Algorithms

Here, you'll find a collection of algorithms that were written as exercises between 2013 and 2014 in various programming languages, including Python 2.x, C++, and C. These algorithms cover a range of topics and can be a valuable resource for learning and reference.

Python 2.x

Aho-Corasick

The Aho-Corasick algorithm is used for string matching and is particularly efficient when searching for multiple patterns in a given text simultaneously.

Radix Sort

Radix Sort is a non-comparative sorting algorithm that works by distributing elements into buckets based on their individual digits or significant places.

Counting Sort

Counting Sort is a stable, non-comparative sorting algorithm that works well when the range of input values is known and relatively small.

Quick Sort

Quick Sort is a popular sorting algorithm that uses a divide-and-conquer approach to efficiently sort a list of elements.

Infix to Postfix

This algorithm converts an infix expression to a postfix expression, which can be useful in various computational tasks.

Infix to Prefix

Similar to the previous algorithm, this one converts an infix expression to a prefix expression.

Tower of Hanoi (Recursive)

The Tower of Hanoi problem is a classic example of recursion. This algorithm solves the Tower of Hanoi puzzle using a recursive approach.

Tower of Hanoi (Non-recursive)

In contrast to the recursive solution, this algorithm solves the Tower of Hanoi puzzle using an iterative approach, which can be helpful for understanding the difference between recursive and iterative problem-solving.

C++

Merge Sort

Merge Sort is a popular sorting algorithm known for its stable and efficient performance. It uses a divide-and-conquer strategy to sort a list of elements.

Insertion Sort

Insertion Sort is a simple and efficient sorting algorithm that builds the final sorted array one item at a time.

Inversion Sort

Inversion Sort, also known as Counting Inversions, is an algorithm used to count the number of inversions in an array. An inversion is a pair of elements (i, j) such that i < j and arr[i] > arr[j].

C

Infix Expression Evaluation

This algorithm evaluates an infix expression and computes the result. It demonstrates how to handle arithmetic expressions with parentheses, operators, and operands.