The internet is a pretty rad place. I just googled “pictures of cats” and got back 2.9 billion results in less than 0.48 of a second. How insane is that?
Whenever we use a search engine such or any website for that matter, we often take for granted the number of steps that are happening behind the scenes in order for us to get content to display on our screens. …
I remember fondly when I first encountered the internet at the ripe age of eight and thinking it was the best thing on earth. I was able to download music at blazing 56 kb/second speed, read about my favorite video games on GameFAQs.com and chat with my friends/random strangers on Aim Messenger. It was truly a brand new world.
Twenty years later, the internet is still pretty awesome. Many things have changed since then; it is no longer a nice thing to have, but rather a necessity in our everyday lives. The internet is a digital fabric that is woven…
Love it or hate it, sorting is a task that every software engineer will be asked to study or implement at one point in their career. In today’s world, there are countless algorithms used to achieve this purpose, each with their own strengths and weaknesses. Some perform better in time complexity but require extra space, some perform extraordinary well in speed but are limited with positive integers only, while others will turn your computer into a portable heater.
Today I am going to test the speed of 10 different sorting algorithms in Python. …
How machine learning works:
Interviewer: What’s your biggest strength?
Computer: I’m a fast learner.
Interviewer: What’s 11 * 11?
Computer: It’s 65
Interviewer: Not even close. It’s 121.
Computer: It’s 121.
The first thought a lot of people associate with artificial intelligence is killer robots taking over the world like in blockbuster movies such as Terminator and Ex Machina.
Although that inevitable future is still quite far away, AI is very much a big part of all of our lives in the devices and technologies we use. From applications like Amazon’s Alexa who orders our groceries for us, or Netflix…
In computer science, a hash table is a data structure that implements an array of linked lists to store data. Using a hash algorithm, the hash table is able to compute an index to store string different key-value pairs.
Today, I will demonstrate how to create this data structure in C++. This is my first application written in this language so all criticism and feedback to help me improve is welcome. :)
The first thing we need to do is create a Node class to store our key-value pair.
In Python and other Object-Oriented languages, classes are considered the blueprint to creating objects. An instance is a copy of the class with actual values.
To define a class in Python3, you can do the following:
passm = Monster()
type(class) # <class '__main__.Monster'>
Class attributes are attributes which are owned by the class itself. They will be shared by all the instances of the class. Therefore they will have the same value for every instance. We define class attributes outside of all the methods, usually, they are placed at the top, right below the class header.
Object-oriented Programming, or OOP for short, is a programming paradigm which provides a means of structuring programs so that properties and behaviors are bundled into individual objects. In Python, every data type underneath the hood is actually an object with its own attributes and methods. Similarly to other OOP languages, Python uses classes as an object constructor or a “blueprint” for creating objects.
Using the interpreter, a user can find the type of object a value or variable is by entering the following:
type(5) # <class 'int'>
type("hello") # <class 'str'>
type([1, 2, 3]) # <class 'list'>
You can also…
In computer science, integers can take up 1, 2, 4, or 8 bytes in memory. Each of these bytes is comprised of 8 bits, each of which can be either be a 1 or 0, true or false. Like lights turning off and on, the combination of these bits together represents characters and numbers that we see on our screen. When people say computers only understand 0’s and 1’s, this is essentially true on a very large scale. Computers can compute billions of these bytes per second and perform bitwise calculations at incredulous speeds.
Today we will look closely at…
Today we are going to write a function that determines if a singly linked list is circular and if it is, we are going to return the node where the cycle begins. This solution is based off of Robert Floyd’s algorithm, first discovered in the 1970’s.
A singly linked list in C is a linear data structure where each element is a separate struct (or class/object in other languages). Linked list elements are not stored at contiguous memory locations; the elements are linked using pointers. Each node of a list is made up of two items — the data and…