Algorithms and Data Structures in Python: Bubble Sort and its Optimization

Introduction

Sorting is one of the most basic algorithm types and it appears quite often in interview. Among them, bubble sort is probably the most fundamental one. The naive bubble sort is usually not that efficient, however, it’s important to understand how it works and how it can be optimized.

Naive Bubble Sort

Native bubble sort used a nested loop to iterate through the target array, and swap each pair of adjacent elements if…

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Frequently asked questions about 2GT issuance

Delta Lake (Part 2) — Overcoming challenges of Data Lake

Design Patterns in Unity With Among Us — Fixing Wires Task

Introduction to Customer Analytics

Python Tutorial 11 Of 50: Make your Life Easier With These 25 Built-in Functions

Docker Compose from development to production

Numpy Introduction- Numerical Python

Alphr Weekly Report #18

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Yue

Yue

More from Medium

Intro to NumPy | Why to learn NumPy | NumPy Creating Arrays

Titanic Survival Prediction using Tensorflow

Learning Dijkstra’s Algorithm

Glob Module in Python-Explained

a man holding bunch of files and looking for specific files.