What are algorithms and how are they used?

Algorithms represent processes or set of rules which are followed in calculations or other math problems. They solve problems, primarily by computers. Algorithms are essential for website ranking in the world’s biggest search engine. They have the power to teach a robot to perform certain operations, and they are even involved in the stock market. In many ways, algorithms shape the life we know and make it easier for us. But, what are they precisely, where did they come from and how will they determine the human future? This would be a small guide through the world of algorithms to get you familiar with them.

The history of algorithms

The first time the term algorithm was used was back in 780 by a Persian mathematician Al-Khwarizmi. He was also an astronomer, geographer, and scholar. But, the origin of algorithms goes even further in the past. The first recorded mathematical algorithms were in 1600 BC when Babylonians developed them for factorization and finding square roots. However, the modern algorithms appeared in the late 1920s and were developed through 1930s. The first one who introduced the recursive functions was Godel-Herbrand-Kleene.

Features of algorithms

They must stop at a particular time – for example, if your task is to make a meal, then the algorithm is a meal recipe. Here you are instructed what to do, how to prepare, what ingredients to mix, what temperature to set and when to stop making, to cook a delicious dish. The same rule applies to algorithms.

It must have detailed step-by-step instructions – if your task is to locate some building, then the algorithm is a set of directions which will clearly explain where to go and what to do to find the building.

It must prove effectiveness – if your task is to build a toy car, then the algorithm is your instruction manual, which will guide you through this process. It will help you assemble the parts, and you will end up with a functional toy.

Dominant algorithms

In the digital world, everything is connected, from search engines, social networks to online marketing. In this case, the study of relations between different entities is essential. There are a lot of approaches and features of link analysis, and each of them can be an algorithm, although the bases are similar. For example, think about Facebook’s friend suggestions, YouTube video recommendations, Google’s page rank. Even though the parameters may be different, but the math behind them is the same. The algorithms are working behind our screens, and average users aren’t aware of it.

Data compression

From zip to mp3 and from JPEG to MPEG-2, these algorithms compress data and make systems more affordable, more efficient and more accessible to transmit. Data compression is often used in video games, videos, music, cloud computing, data storage, databases and any files you download to your computer. This type of algorithm will save you a lot of space and make your system run smoothly.

The freeze app – What is this app and does it exist

Nowadays, you can find apps for almost anything, and some of them will freeze your phone, maybe they are infected, or it’s just the negligence of the developer. For instance, the app might try to perform some math operation, such as dividing five by 0. On the other hand, your math teacher will tell you that 5/0 does not make sense, but when a modern computer meets this expression it will freeze and in the worst-case scenario, crashing your operating system with it. Once your phone freezes, there is not much you can do, but to restart the device and after that remove the app from your smartphone.

But, then the main questing is, why such bad apps exit in the first place and can you test them for such behavior before the use.

The Freeze App

Let’s imagine that some software company managed to solve this issue, where there is a Freeze app who will test all other apps and determine whether they will freeze your phone. This type of app might work by performing experiments for the suspicious apps in a simulated environment, without stopping your phone. Or, it will just deduce the input app’s behavior from inspecting its source code. For average users, it’s not relevant how Freeze app manages what it promises. Its use would be straightforward to use. First, you will have to select the suspicious app you want to test, and it has to be installed on your smartphone. Then Freeze app will do its analytics, which might take a couple of minutes and present you the final result.

As soon as Freeze app gets to store, developers will try to build a Paradox app, and its primary purpose will be to rectify mistakes the Freeze app makes. So, here is how it should look like: you run the Freeze app to in inspect the Paradox, if it turns out OK, then freeze your phone, for instance by computing five by 0. On the other hand, if the Freeze shows not OK, then declare Freeze detected that Paradox freezes and terminate the process.

Why doesn’t Freeze app exist?

There are a couple of reason why this type of app doesn’t exist. Either the Paradox app is malicious and freezes your phone, or it’s not. But, we will show you both cases. For example, let’s assume that Paradox is corrupted and freezes your phone. In this case, the Freeze app will detect this condition, and in Paradox’s code, computation proceeds from line one to three and Paradox will show the information “Freeze detected that Paradox freezes” and it will end this process. According to our assumptions, the phone did not freeze, and we can reject this proposition.

In the second example, the Paradox doesn’t freeze our phone. The Freeze app will determine this and Paradox’s computation will continue with line two and freeze the phone, which again contradicts our assumptions. Based on this, we can end our discussion stating that Freeze app doesn’t exist.

Including Git Revision Identifiers in LaTeX

In the last couple of years, LaTeX software has become very popular for the production of technical and scientific documentation. This is a high-quality typesetting system which is available as free software. The majority of LaTeX source files are under the revision control system Git. Git is additional software, and it allows you to do many things, but keep in mind that Git doesn’t modify source files, while other systems do. For instance, you can ask Subversions to replace the placeholders \$Revision in the committed source file with the latest revision number. This is a handy solution for presenting figures and dates in your LaTeX documents.

Git’s representatives often state that any type of modification of source file is pure evil. This feature is absent from Git, and every betokens moral corruption. In this case, the client’s program, which is LaTeX, is responsible for any modification and revision information in the output. Git only makes this information available, but it doesn’t change the source. Stephen Henning’s vc batch contains a number of scripts that extract modified information from different version control systems, involving Git, and make it available as LaTeX macros. In this case, we use vc.tex to take information and the primary LaTeX source file remains untouched by Git.

We have another rule, which might be interesting, and it involves running git code to produce vc.code. But, the hardest thing for people is to get the dependencies right, and we will break down this entire process. The input file vc.tex needs to be regenerated whenever it predates the last commit. If you have a good understanding of Git internals than the command that requires the modification of time .git/logs/HEAD, should provide you are the reliable timestamp for the last commit. You can make a rule for vc.tex depend on that. Considering this a cheap operation, you will be able to generate vc.tex anew every time you run pdf latex. Only, in this case, every move you make will recompile the source because the initial file vc.tex has changed. If you want to avoid this complication, then you should leave out vc.tex from dependencies for \$(latexfile).pdf. So, when you commit, which changes the revision number and not source files, the process will not lead to an automatic recompile. In this case, the LaTeX document will only show newly revised information, whenever it’s edited after that revision.

LaTeX is a document preparation software for high-quality typesetting. It is commonly used for medium to large technical or scientific documents and can be used for any form of publishing. You need to keep in mind that LaTeX is not a word processing software and it won’t help you with the appearance. LaTeX focuses more on the right content and enables you to deliver accurate information. This software is based on the idea that document design is to be left to document designers, while authors should pay attention to writing and delivering high-quality content.