Cory Althoff - The Self-Taught Computer Scientist

Здесь есть возможность читать онлайн «Cory Althoff - The Self-Taught Computer Scientist» — ознакомительный отрывок электронной книги совершенно бесплатно, а после прочтения отрывка купить полную версию. В некоторых случаях можно слушать аудио, скачать через торрент в формате fb2 и присутствует краткое содержание. Жанр: unrecognised, на английском языке. Описание произведения, (предисловие) а так же отзывы посетителей доступны на портале библиотеки ЛибКат.

The Self-Taught Computer Scientist: краткое содержание, описание и аннотация

Предлагаем к чтению аннотацию, описание, краткое содержание или предисловие (зависит от того, что написал сам автор книги «The Self-Taught Computer Scientist»). Если вы не нашли необходимую информацию о книге — напишите в комментариях, мы постараемся отыскать её.

The Self-Taught Computer Scientist
The Self-Taught Programmer
In
, Cory showed readers why you don't need a computer science degree to program professionally and taught the programming fundamentals he used to go from a complete beginner to a software engineer at eBay without one.
In
, Cory teaches you the computer science concepts that all self-taught programmers should understand to have outstanding careers.
will not only make you a better programmer; it will also help you pass your technical interview: the interview all programmers have to pass to land a new job.
Whether you are preparing to apply for jobs or sharpen your computer science knowledge, reading
will improve your programming career. It's written for complete beginners, so you should have no problem reading it even if you've never studied computer science before.
 

The Self-Taught Computer Scientist — читать онлайн ознакомительный отрывок

Ниже представлен текст книги, разбитый по страницам. Система сохранения места последней прочитанной страницы, позволяет с удобством читать онлайн бесплатно книгу «The Self-Taught Computer Scientist», без необходимости каждый раз заново искать на чём Вы остановились. Поставьте закладку, и сможете в любой момент перейти на страницу, на которой закончили чтение.

Тёмная тема
Сбросить

Интервал:

Закладка:

Сделать

Sticking with It

There is one last thing I want to cover before you dive into learning computer science. If you are reading this book, you've already taught yourself to program. As you know, the most challenging part about picking up a new skill like programming isn't the difficulty of the material: it is sticking with it. Sticking with learning new things is something I struggled with for years until I finally learned a trick that I would like to share with you, called Don't Break the Chain.

Jerry Seinfeld invented Don't Break the Chain. He came up with it when he was crafting his first stand-up comedy routine. First, he hung a calendar up in his room. Then, if he wrote a joke at the end of each day, he gave himself a red X (I like the idea of green check marks better) on the calendar for that day. That's it. That is the entire trick, and it is incredibly powerful.

Once you start a chain (two or more green check marks in a row), you will not want to break it. Two green check marks in a row become five green check marks in a row. Then 10. Then 20. The longer your streak gets, the harder it will be for you to break it. Imagine it is the end of the month, and you are looking at your calendar. You have 29 green check marks. You need only one more for a perfect month. There is no way you won't accomplish your task that day. Or as Jerry Seinfeld describes it:

After a few days, you'll have a chain. Just keep at it, and the chain will grow longer every day. You'll like seeing that chain, especially when you get a few weeks under your belt. Your only job next is to not break the chain.

My dedication to preserving one of my chains has led me to do crazy things, like going to the gym in the middle of the night, to keep it intact. There is no better feeling than looking back at the calendar page containing your first perfect month and seeing it filled with green check marks. If you are ever in a rut, you can always look back at that page and think about the month where you did everything right.

Technical books are hard to get through. I've lost count of how many I've abandoned partway through. I tried to make this book as fun and easy to read as possible, but to give yourself extra insurance, try using Don't Break the Chain to ensure you finish this book. I also partnered with monday.comto create a free Self-Taught Programmer template and app that keeps track of your coding streaks for you. You can try it at https://hey.monday.com/CoryAlthoff.

With that said, are you ready to study computer science?

Let's get started!

1 What Is an Algorithm?

Whether you want to uncover the secrets of the universe or you just want to pursue a career in the 21st century, basic computer programming is an essential skill to learn.

Stephen Hawking

An algorithmis a sequence of steps that solves a problem. For example, one algorithm for making scrambled eggs is to crack three eggs over a bowl, whisk them, pour them into a pan, heat the pan on a stove, stir them, and remove them from the pan once they are no longer runny. This section of the book is all about algorithms. You will learn algorithms you can use to solve problems such as finding prime numbers. You will also learn how to write a new, elegant type of algorithm and how to search and sort data.

In this chapter, you will learn how to compare two algorithms to help you analyze them. It is important for a programmer to understand why one algorithm may be better than another because programmers spend most of their time writing algorithms and deciding what data structures to use with them. If you have no idea why you should choose one algorithm over another, you will not be a very effective programmer, so this chapter is critical.

While algorithms are a fundamental concept in computer science, computer scientists have not agreed on a formal definition. There are many competing definitions, but Donald Knuth's is among the best known. He describes an algorithm as a definite, effective, and finite process that receives input and produces output based on this input.

Definiteness means that the steps are clear, concise, and unambiguous.

Effectiveness means that you can perform each operation precisely to solve the problem.

Finiteness means that the algorithm stops after a finite number of steps.

A common addition to this list is correctness . An algorithm should always produce the same output for a given input, and this output should be the correct answer to the problem the algorithm solves.

Most, but not all, algorithms fulfill these requirements, and some of the exceptions are important. For example, when you create a random number generator, your goal is to generate randomness so someone can't use the input to guess the output. Also, many algorithms in data science are not strict about correctness. For example, it may be sufficient for an algorithm to estimate output, as long as the estimate's uncertainty is known. In most cases, however, your algorithms should fulfill all the previous requirements. If you write an algorithm for making scrambled eggs, the user might not be happy if, occasionally, the algorithm produces an omelet or boiled eggs instead.

Analyzing Algorithms

There is often more than one algorithm we can use to solve a problem. For example, there are several different ways to sort a list. When several algorithms solve a problem, how do you know which one is best? Is it the simplest? The fastest? The smallest? Or something else?

One way to judge an algorithm is by its run time. An algorithm's run timeis the amount of time it takes your computer to execute an algorithm written in a programming language like Python. For example, here is an algorithm in Python that counts from 1 to 5 and prints each number:

for i in range(1, 6): print(i)

You can measure this algorithm's run time using Python's built-in timemodule to track how long your computer takes to execute it:

import time start = time.time() for i in range(1, 6): print(i) end = time.time() print(end – start) >> 1 >> 2 >> 3 >> 4 >> 5 >> 0.15141820907592773

When you run your program, it prints the numbers from 1 to 5 and outputs the time it took to execute. In this case, it took 0.15 seconds.

Now, rerun your program:

import time start = time.time() for i in range(1, 6): print(i) end = time.time() print(end – start) >> 1 >> 2 >> 3 >> 4 >> 5 >> 0.14856505393981934

The second time you run your program, you should see a different run time. If you rerun your program, you will see yet another run time. The algorithm's run time keeps changing because the available processing power your computer has when it runs your program varies and in turn affects the program's run time.

Further, this algorithm's run time would be different on another computer. If you run it on a computer with less processing power, it would be slower, whereas it would be faster on a more powerful computer. Furthermore, this program's run time is affected by the programming language you wrote it in. For example, the run time would be faster if you run this same program in C because C can be faster than Python.

Because an algorithm's run time is affected by so many different variables, such as your computer's processing power and the programming language, run time is not an effective way to compare two algorithms. Instead, computer scientists compare algorithms by looking at the number of steps they require. You can input the number of steps involved in an algorithm into a formula that can compare two or more algorithms without considering the programming language or computer. Let's take a look at an example. Here is your program from earlier that counts from 1 to 5:

Читать дальше
Тёмная тема
Сбросить

Интервал:

Закладка:

Сделать

Похожие книги на «The Self-Taught Computer Scientist»

Представляем Вашему вниманию похожие книги на «The Self-Taught Computer Scientist» списком для выбора. Мы отобрали схожую по названию и смыслу литературу в надежде предоставить читателям больше вариантов отыскать новые, интересные, ещё непрочитанные произведения.


Отзывы о книге «The Self-Taught Computer Scientist»

Обсуждение, отзывы о книге «The Self-Taught Computer Scientist» и просто собственные мнения читателей. Оставьте ваши комментарии, напишите, что Вы думаете о произведении, его смысле или главных героях. Укажите что конкретно понравилось, а что нет, и почему Вы так считаете.

x