Explore 1.5M+ audiobooks & ebooks free for days

Only $12.99 CAD/month after trial. Cancel anytime.

GROKKING ALGORITHMS: Advanced Methods to Learn and Use Grokking  Algorithms and Data Structures for Programming
GROKKING ALGORITHMS: Advanced Methods to Learn and Use Grokking  Algorithms and Data Structures for Programming
GROKKING ALGORITHMS: Advanced Methods to Learn and Use Grokking  Algorithms and Data Structures for Programming
Ebook167 pages3 hours

GROKKING ALGORITHMS: Advanced Methods to Learn and Use Grokking Algorithms and Data Structures for Programming

Rating: 0 out of 5 stars

()

Read preview

About this ebook

Welcome to Grokking Algorithms: Advanced Methods to learn and use Grokking Algorithms and Data structures for Programming.


Even before the conception of the computer itself, algorithms existed. After the computer was introduced and with all the development that followed, the number of existing algorithms grew increasingly. At t

LanguageEnglish
PublisherEric Schmidt
Release dateJul 26, 2023
ISBN9781088225462
GROKKING ALGORITHMS: Advanced Methods to Learn and Use Grokking  Algorithms and Data Structures for Programming
Author

Eric Schmidt

Eric Schmidt (Washington D.C., 1955) es un empresario e informático estadounidense, director ejecutivo de Google desde 2001 hasta 2011. Actualmente es el presidente ejecutivo de la empresa. En agosto de 2015 fue escogido como presidente de Alphabet Inc. después de la reorganización empresarial de Google.

Read more from Eric Schmidt

Related to GROKKING ALGORITHMS

Related ebooks

Programming For You

View More

Reviews for GROKKING ALGORITHMS

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    GROKKING ALGORITHMS - Eric Schmidt

    Introduction

    Welcome to Grokking Algorithms: Advanced Methods to learn and use Grokking Algorithms and Data structures for Programming.

    Even before the conception of the computer itself, algorithms existed. After the computer was introduced and with all the development that followed, the number of existing algorithms grew increasingly. At this stage, it wouldn't be wrong to say that algorithms are the core of what computing today is capable of.

    Grokking Algorithms provides a very comprehensive and interesting introduction to the world of computer algorithms. We will look at a lot of algorithms and their uses, and we'll even learn how to manipulate them step by step. Even though the book is aimed at an audience with a more advanced level of knowledge, we have tried to convey most of the explanations and knowledge contained within the book in an easygoing manner to make it easier to understand.

    We have discussed multiple algorithms and data structures throughout the book. The algorithms are laid out in pseudocode (which is more similar to English than programming) and can be read by anyone with a basic programming knowledge level.

    Finally, we'd like to thank you for choosing Advanced Methods to learn and use Grokking Algorithms and Data structures for Programming, and we welcome you to Grokking Algorithms!

    Chapter 1

    An Introduction to the Basics

    Do you remember what the original computer was originally intended for? The modern-day digital computer we see today was invented to simplify complex computations. With the computer, time-consuming and complex computations were facilitated and sped up, drastically reducing the immense manpower and resources allocated.

    Now, what sort of computations, you might wonder, and it isn't uncommon for that question to occur. After all, modern-day computers, in usage, are more inclined towards the manipulation of information rather than computation. For example, computers today are more popular for their ability to store large wads of information. However, the ability to store information wouldn't be all that useful without the ability to access the said information at will, any time you want.

    With this combination of storing and retrieving data, the system's computation part, which it was originally intended for (like arithmetic calculations, etc.), has become irrelevant for the most part. You might be wondering, what does all of this have to do with the topic at hand, data structures? Well, let's find out.

    All the information we've disclosed up to this point has had two main reasons:

    To define what the term data will refer to in the book. Data, by definition, can have multiple meanings according to its context. In this book, whenever we utilize or refer to the term data, we're referring to any type of information that your machine or computer (to be specific) is currently storing or manipulating. These points need to be elaborated on because many seasoned developers often refer to data as information that has already been processed. That is simply too narrow for our use throughout the book.

    To give you an introduction to data structures and where they stem from, which is something we'll jump onto next.

    What Are Data Structures?

    Data structures are simply a method of storing and utilizing all the different types of data. Better yet, you can think of them as not storing. Rather, a much better explanation would be to say that data structures are used to organize data.

    However, that isn't all data structures are capable of doing. As the world continues to progress on the path of development, the importance of data continues to increase, too, and along with it, so does the significance of data structures.

    Data structures are vital in identifying the type of data present and also help to find specific data from other data. Furthermore, they also highlight the relationship that all the different types of data within the structure have with each other.

    Now, it might be a little hard for you to understand at this point, so let's take an example. Can you think of different types of footwear? Men or women’s wear doesn't matter, but they have to be of different types, for example, joggers, slippers, etc. You can arrange these footwears alternatively; take a look at the illustration below:

    J  S  J  S

    The illustration above replaces joggers with the letter J, whereas slippers are substituted with the letter S.

    Now, you can classify each footwear representation, which in this case would be a single letter (for example, the J for jogger), as a unit of data. If, for any reason, you want to maintain the same arrangement for all of the data to come (that is, alternative placement of joggers and slippers), you would have to refer to or employ which would manipulate the data by identifying and ordering the footwear.

    With that being said, a data structure can provide multiple mechanisms that help manipulate and organize data. For instance, if we were to continue the example above, another arrangement could include:

    J  S  S  J

    That isn't all; data structures can also help assign identifiers to the footwear in the example above. For instance:

    J  S  J  S

    0  1  2  3

    Continuing the example above, assigning a numerical identifier would look something like this. You should remember that, since we're simply on the basics at the moment, assigning a numerical identifier would be irrelevant to the type of footwear it is assigned to. You'll be able to witness this from the example above; even though the type of footwear on index number 0 and index number 2 are the same (both are joggers), they have been assigned different index numbers.

    Therefore, if you were to try to call any of these footwears, you'd have to refer to them by their assigned identifier. For instance, if you wanted to have the first slipper, you'd have to call the slipper on index number 1 to get it; simply stating the slipper would be too vague!

    And that's all, folks! We're not kidding. That really is all! As elementary as all of the knowledge above might seem, that is all data structures do. While the types of data structures and how they manipulate and store data continue to grow more and more complex, if we're talking about a simple introduction to the concept of data structures, that's all you need to know at the moment. And no need to worry. It's not like we won't delve into some of the more advanced data structures and the complex relationships of their data later on.

    If you're still unclear about what a data structure stands for, you can reread the lesson again (just in case you missed out on something). However, this time, reread the subtopic while keeping in mind that data structures are simply containers that are meant for data, and you'll be able to understand some of the concepts in the lesson much more easily.

    What Are Algorithms?

    To put it bluntly, an algorithm is a sequence or order of steps intended to solve a problem. This sequence must be followed in the correct order and will always work to the problem that it was initially designed to solve. Now, you might think that any solution that is not designed with a sequence of steps might not be an algorithm, and voila! You're right on the mark. An algorithm is a method of solving problems by dividing the intended solution into steps to follow easily.

    A simpler way of understanding an algorithm would be to think of it as a problem-solving technique that solves its problems in an ordered sequence. You can even shorten the definition to a single word: an algorithm is simply a procedure. (You might think of it as unnecessary to spend so much time on the definition, but not everyone would have understood if we'd just started by saying it is a procedure!). Many people, from professionals to newbies who have just started out programming, have varying ideas of what an algorithm actually is. If you're a reader of this book, it will be enough for you to get by any of the three definitions that we've stated above, as long as you understand.

    However, no matter how much the definition may vary from individual to individual, everyone, newbies and professionals alike, agree that algorithms comprise logical steps to accomplish a set task. To achieve success with the said task (which can be anything at this point), it simply isn't enough to have logical and orderly steps. If you want your sequence to classify as a good algorithm, these logical steps must be precise, simple, and unambiguous. Simply speaking, they shouldn't be fluffed out and give a simple yet straightforward solution to a problem.

    However, this is, once again, subject to each individual's taste. Some programmers tend to make needlessly complex algorithms by using esoteric features present in many programming languages to make their algorithms hard to decipher. However, you should understand that making an algorithm easy to understand is a good practice, and the easier it is for

    Enjoying the preview?
    Page 1 of 1