Binary search is an important search algorithm. It is an efficient method to search for a specific element within a sorted array. While it’s a pretty simple and intuitive concept, it is a powerful tool and one worth getting deeply familiar with.
Binary search works by taking in an array sorted in ascending order and determining the middle element of the array. It then compares this middle element to the element you are searching for. If the element you are looking for happens to be the middle element of the array, then you’ve found the element in O(1)…
The only way to get better at algorithms is through consistency and practice — so let’s jump right back in to another algorithm practice. This week, we’re going to take a look at the validate subsequence algorithm. This is an algorithm that is quite common and relatively straight-forward, so it’s a good one to practice with if you’re just starting out with algorithms.
Let’s take a look at the problem:
Note that both a single number in an array as well as the array itself are valid subsequences of the array.
Before we dive in to the problem, let’s first…
Data structures are the cornerstone of algorithms. In order to write and run efficient code, you must possess a solid understanding of data structures. Once you have a good grasp on different data structures and how they work, you can start to identify the pros and cons of specific data structures and then make an informed decision as to when and where they should be implemented.
A binary search tree — commonly referred to in its shortened form, BST — is a data structure that allows for the efficient storage of integers in an ordered fashion. Binary search trees are…
Happy 2021! It’s a new year and a fresh start, and we’re diving right back in to mastering algorithms.
I have been busy preparing for upcoming interviews and doubling down on getting algorithm practice in, so this week, let’s get in to the third iteration of the Algorithm Practice series.
This week, we will do a walkthrough of the Product Sum algorithm problem. It is another algorithm that often comes up during technical interviews. Given an array, our task is to write a function that returns its product sum.
Some things to clarify before we get in to thinking about…
The Caesar Cipher Encryptor is next up in our series of algorithm problem walkthroughs. Classified as an “easy” algorithm on websites like Leetcode, this is another classic problem that comes up often in technical interviews and is good practice for any Software Engineer looking to brush up on their problem-solving skills.
First, some background information on the Caesar Cipher so we know what we’re dealing with.The Caesar Cipher is a simple example of cryptography, which is defined by Merriam-Webster as: the enciphering and deciphering of messages in secret code or cipher.
Also: the computerized encoding and decoding of information.
Here’s a classic algorithm problem that comes up quite often in technical interviews: given a string, how can we check whether it is a palindrome or not?
Before we dive in to the problem itself, let’s step back for a second and go over what a palindrome is. A palindrome is a string that reads the same forwards and backwards. The classic example is “racecar” — read backwards, the string is still “racecar”.
Now that we are clear on the concept of the palindrome, let’s get in to the algorithm and how to approach solving it: Given a non-empty string…
A Quick Dive Into Stacks
Data Structures: Why Should We Care?
The first step in understanding and excelling at algorithms is having deep knowledge of data structures. Data structures are the foundation of Computer Science and Software Engineering, and as such, we have to have a good grasp of the basics of the most common data structures in order to be good at what we do.
When developing an application, a common issue that developers run into is one involving CORS. This is an issue that is quite frustrating when it comes up — you’ve spent hours coding, testing, and cleaning up your code, only to find that CORS is blocking a request that your application depends on to run. Luckily, the issue is one that is well-documented and not too hard to fix.
What is CORS?
CORS stands for Cross-Origin Resource Sharing and it is a security policy that handles the way in which requests for resources from external origins are managed. The main purpose…
Nowadays, when you log on to any website, chances are that you’ll come across a chatbot. Chatbots are widely used across web applications in order to perform tasks — such as greeting customers and providing answers to frequently asked questions — that were once relegated to human beings.
Today’s chatbots are surprisingly complex, intelligent, and efficient, making them a no-brainer for most websites. While the AI and machine learning that goes in to chatbots are increasingly complicated, the task of building and customizing your own chatbot has become easier than ever. …
A Review of OOP and Its Core Principles
What is OOP?
Object-oriented programming, often referred to as just OOP, is a programming pattern that revolves around the concept of objects. Objects are bundles of code that contain attributes and have behaviors in the form of methods. This idea of objects allows us to create applications that more closely mimic the way the real world works. OOP allows us to structure our code in a way that makes it possible to reuse our code and easily share functionality throughout an application.
Classes as Blueprints
In OOP, classes are an important concept…
Fullstack Software Engineer based in NYC. Passionate about creating social change and making a difference through innovative, powerful technologies.