Tag: algorithms

Total 36 Posts

Selection Sort in Python

Introduction

Sorting, although a basic operation, is one of the most important operations a computer should perform. It is a building block in many other algorithms and procedures, such as searching and merging. Knowing different sorting algorithms could help you better understand the ideas behind the different algorithms, as well

Continue Reading

Heap Sort in Python

Introduction

Heap Sort is another example of an efficient sorting algorithm. Its main advantage is that it has a great worst-case runtime of O(n*logn) regardless of the input data.

As the name suggests, Heap Sort relies heavily on the heap data structure - a common implementation of a

Continue Reading

Merge Sort in Python

Introduction

Merge Sort is one of the most famous sorting algorithms. If you're studying Computer Science, Merge Sort, alongside Quick Sort is likely the first efficient, general-purpose sorting algorithm you have heard of. It is also a classic example of a divide-and-conquer category of algorithms.

Merge Sort

The way Merge

Continue Reading

Stochastic Optimization: Random Search in Java

Introduction

Stochastic Optimization refers to a category of optimization algorithms that generate and utilize random points of data to find an approximate solution.

While brute-force algorithms do provide us with the best solution, they're terribly inefficient. This isn't an issue with smaller datasets, but most real-life problems and search-spaces require

Continue Reading

Sorting Arrays in JavaScript

Like many other popular languages, JavaScript conveniently comes with a built-in method for sorting arrays. While the end result is the same, the various JavaScript engines implement this method using different sort algorithms:

  • V8: Quicksort or Insertion Sort (for smaller arrays)
  • Firefox: Merge sort
  • Safari: Quicksort, Merge Sort, or Selection
Continue Reading

Insertion Sort in Java

Introduction

Sorting is a crucial aspect of digesting data. For us humans, it's much more natural to sort things that have something in common like the date of publishing, alphabetical order, articles belonging to an author, from smallest to largest, etc. This makes it a lot easier to comprehend the

Continue Reading

Merge Sort in Java

Introduction

Sorting is a crucial aspect of digesting data. For us humans, it's much more natural to sort things that have something in common like the date of publishing, alphabetical order, articles belonging to an author, from smallest to largest, etc. This makes it a lot easier to comprehend the

Continue Reading