When it comes to writing reusable and extensible code in Python, abstract classes are an essential tool in your arsenal. Abstract classes define a set of methods that a subclass must implement, but it doesn’t provide an implementation for those methods itself. This feature makes them a powerful way to enforce certain behavior while also…
Read moreTag: algorithms
Binary Search Tree
![](http://karolos.me/wp-content/uploads/2021/02/bst-1.jpg)
Any tree that its elements have at most two children nodes is called a binary tree. Those children nodes are referred typically as the left and the right child. As we can see a tree is not a linear data structure and represents nodes that are connected by edges. A tree has the following properties:…
Read moreBubble Sorting in Python
![](http://karolos.me/wp-content/uploads/2021/02/bubble_sort-1.jpg)
Bubble Sort is the simplest sorting algorithm. It works by changing positions in the adjacent elements if they are in the wrong order. Basic Example Assume we have the following list of integers: (32, 5, 12, 9, 72) With bubble sort, we will traverse through the list and compare the adjacent elements, as many times…
Read more