Software Design Archive

Hashing in Java

In this post, we will discuss hashing in Java and introduce a few data structures such as hashtables and hashmaps that rely on hashing. What is Hashing? Hashing is a technique that allows a program to store and subsequently find an object in a large collection of items without going through every item. A

Priority Queue in Java: A Complete Introduction

In this post, we introduce the priority queue in Java and explain the underlying concept of a heap. What is a Priority Queue in Java? In a priority queue, items are ordered alphabetically in ascending order, numerically in ascending order, or according to a user-defined attribute based on a custom comparator. In a priority

The Queue in Java

In this post we learn how to implement a queue in Java using the linked list and priority queue data structures provided by Java. What is a Queue in Java? A queue is a data structure in Java and many other programming languages. Elements are added according to the FIFO (first-in, first-out) principle. An

The Stack in Java

In this post we look at the stack in Java, a data structure that operates on the LIFO principle. We discuss (clicking the link will take you to the section): What is a Stack How to implement a Stack using collections and deque How to implement a Java stack from scratch What is a

How to Learn Java: A Comprehensive Guide

Java is one of the most widely used programming languages in the world today. It powers applications ranging from enterprise software systems to Android apps. Learning it can open the door to plenty of well-paid job opportunities. People who have mastered the art of developing software in Java are hot commodities in the job

An Introduction to Java Arrays

In. this post we introduce and define the array data structure in java, how to use it and what common operations can be performed using arrays. What is an Array in Java? An array is a fixed-length Java container object that contains other objects of the same type. An array’s length and the type

Python Collections Module

In this post, we will introduce the collection module in Python, which provides a range of container types for object storage. We introduce the concept of a container in Python and then we go through the available container types. What is a Container in Python? Containers in Python are meta-objects that can hold an

Priority Queue and Heapq in Python

In this post we learn how to create priority queues using Python. There are 3 main ways to implement and use a priority queue in Python: Create a list and keep it manually sorted Use a binary heap on the basis of Python’s heapq module Use the priority queue implementation from Python’s Queue package

The Queue in Python

In this post, we learn how to implement a queue in Python using Python’s list data structure, the collections module, and a custom wrapper class What is a Queue in Python? A queue is a data structure that is based on the first-in, first-out principle when adding and removing items. Elements are added to

The Stack in Python

In this post, we will discuss how to implement the stack, a common data structure, in Python. To build the stack we are going to rely on Python’s built-in list data structure and the collections package. What is a Stack in Python? A stack is a data structure that is based on the last-in,