The Self-Taught Computer Scientist


vertex: A piece of data in a graph. payload


Download 1.48 Mb.
Pdf ko'rish
bet140/147
Sana17.06.2023
Hajmi1.48 Mb.
#1540634
1   ...   136   137   138   139   140   141   142   143   ...   147
Bog'liq
books-library.net-11301817Az7X6

vertex: A piece of data in a graph.
payload: Additional data in a graph vertex.
edge: The connection between vertices in a graph.
weight: The cost to travel between vertices.


Chapter 16 Graphs
187
directed graph: A graph where each edge has a direction associated with it, and you can move bet-
ween two vertices only in that direction.
undirected graph: A type of graph where the edges are bidirectional, which means you can travel 
back and forth in either direction between two connected vertices.
complete graph: A graph where every vertex connects to every other vertex.
incomplete graph: A graph where some but not all vertices are not connected.
path: A sequence of vertices connected by edges.
cycle: A path in a graph starting and ending at the same vertex.
acyclic graph: A graph that does not contain a cycle.
edge list: A data structure where you represent each edge in a graph with two vertices that connect.
adjacency matrix: A two- dimensional array of rows and columns that contains a graph’s vertices.
adjacent: Two or more connected vertices in a graph.
adjacency list: A collection of unordered lists, with each list representing the connections for a 
single vertex.
Dijkstra’s algorithm: An algorithm you can use to find the shortest path from a vertex in a graph 
to every other vertex.
Challenge
1. 
Modify Dijkstra’s algorithm so it only returns the path from a starting vertex to another vertex 
you pass in.



17
Self- Taught 
Inspiration: Elon Musk
T
oday, Elon Musk is best known for founding Tesla, Space X, and PayPal, which revolutionized 
their industries. But long before he became an entrepreneur and one of the richest men on the 
planet, Musk was driven by a simpler idea: he wanted to design video games. How did self- taught 
programmer Musk go from a kid playing games to a billionaire? In this chapter, you will learn about 
Musk’s education and how his interest in gaming led him to learn to program.
Musk’s education began across the world from the Los Angeles home where he resides today. Born 
and raised in South Africa, Musk became interested in computers when he was ten years old. Musk was 
a driven child who would sometimes spend 10 hours a day reading books. He was also obsessed with 
video games. Musk explained that his love of video games drove him to learn to program. “I thought 
I could make my own games. I wanted to see how games work,” Musk explained. “That’s what led 
me to learn how to program computers.”
Musk started with a book on the BASIC programming language, a popular language in the 1960s, 
which many computers still used in the 1980s. The book offered a six- month program to learn to code, 
but Musk raced through the entire program in three days. It wasn’t long before Musk programmed 
his first video game. In 1984, when he was just 12 years old, Musk created 
Blastar. The space- based 
shooter drew inspiration from 
Alien Invaders. In Musk’s game, players shot down spaceships carrying 
hydrogen bombs while dodging deadly “status beams.”
Musk pitched his game to 
PC and Office Technology, which offered to buy Blastar for $500. Musk 
already learned how to turn a profit in his first programming venture: an important turning point in 
Musk’s education. 
Blastar taught Musk several vital lessons. First, he realized that after reading a book 
and playing around with coding, he could create his own video game. Translating his learning into a 
final product also brought results: at only 12 years old, Musk was making money from his program-
ming skills.
But Musk’s education did not end there. The drive that pushed Musk to learn programming 
continued into his teen years. At 17 years old, Musk moved from South Africa to Canada, where he 
planned to live with his great- uncle in Montreal. There was just one problem: the uncle had already 
moved to Minnesota, which Musk realized only once he reached Canada. Musk didn’t give up. He had 



Download 1.48 Mb.

Do'stlaringiz bilan baham:
1   ...   136   137   138   139   140   141   142   143   ...   147




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling