diff --git a/README.md b/README.md index ae8bd12fe..f51f41c91 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ The Arcane Algorithm Archive is a collaborative effort to create a guide for all important algorithms in all languages. This goal is obviously too ambitious for a book of any size, but it is a great project to learn from and work on and will hopefully become an incredible resource for programmers in the future. The book can be found here: https://www.algorithm-archive.org/. -The github repository can be found here: https://github.com/algorithm-archivists/algorithm-archive. -Most algorithms have been covered on the youtube channel LeiosOS: https://www.youtube.com/user/LeiosOS -and livecoded on Twitch: https://www.twitch.tv/simuleios. +The GitHub repository can be found here: https://github.com/algorithm-archivists/algorithm-archive. +Most algorithms have been covered on the YouTube channel LeiosOS: https://www.youtube.com/user/LeiosOS +and live coded on Twitch: https://www.twitch.tv/simuleios. If you would like to communicate more directly, please feel free to go to our discord: https://discord.gg/Pr2E9S6. diff --git a/chapters/QI/QI.md b/chapters/QI/QI.md index e30730cb6..ce109366b 100644 --- a/chapters/QI/QI.md +++ b/chapters/QI/QI.md @@ -18,11 +18,11 @@ There are many places to start an introduction to quantum information theory, so 3. **Quantum computers in the wild:** Current experimental techniques to create a quantum computer and what makes them ill-suited as real quantum computers 4. **A survey of current quantum algorithms:** There are a number of algorithms that promise fantastic advantages when performed on quantum computers and should really shake up the industry when they are finally experimentally realized. -As a note, item 3 might seem out of place for a book on algorithms, and I would tend to agree; however, at this point there is a phenominal amount of research being done to realize the first truly quantum computer and there are a number of potential systems that could work for this purpose. +As a note, item 3 might seem out of place for a book on algorithms, and I would tend to agree; however, at this point there is a phenomenal amount of research being done to realize the first truly quantum computer and there are a number of potential systems that could work for this purpose. These systems will change how we think about and interface with quantum computation in the future and it is important to discuss where the field might be heading and when we can expect quantum computers at home. Now, there are not too many languages that can compile quantum code. -A while ago, we tried to make a quantum circuit compiler, which was modelled after the SPICE circuit simulator, but this was far from a computer language. +A while ago, we tried to make a quantum circuit compiler, which was modeled after the SPICE circuit simulator, but this was far from a computer language. At this point in time, it is impossible to tell what quantum computing languages will look like when we finally have a truly quantum machine, so for the time being, we will not ask for community code for the chapters related to quantum information. basically, it's hard to imagine how to would adequately implement Shor's algorithm in C. diff --git a/chapters/convolutions/convolutions.md b/chapters/convolutions/convolutions.md index 6f009e8cc..d3863f067 100644 --- a/chapters/convolutions/convolutions.md +++ b/chapters/convolutions/convolutions.md @@ -61,9 +61,9 @@ Now, let me tell you about a bit of black computational magic: That is crazy! It's also incredibly hard to explain, so let me do my best. -As described in the chapter on [Fourier Transforms](chapters/FFT/cooley_tukey.md), Fourier Tranforms allow programmers to move from real space to frequency space. +As described in the chapter on [Fourier Transforms](chapters/FFT/cooley_tukey.md), Fourier Transforms allow programmers to move from real space to frequency space. When we transform a wave into frequency space, we see a single peak in frequency space related to the frequency of that wave. -No matter what function we send into a Fourier Transform, the frequency-space image can be interpreted as a seires of different waves with a specified frequency. +No matter what function we send into a Fourier Transform, the frequency-space image can be interpreted as a series of different waves with a specified frequency. So here's the idea: if we take two functions $$f(x)$$ and $$g(x)$$ and move them to frequency space to be $$\hat f(\xi)$$ and $$\hat g(\xi)$$, we can then multiply those two functions and transform them back into a third function to blend the signals together. In this way, we will have a third function that relates the frequency-space images of the two input functions. diff --git a/chapters/getting_started.md b/chapters/getting_started.md index a9e5b9962..449264f37 100644 --- a/chapters/getting_started.md +++ b/chapters/getting_started.md @@ -1,6 +1,6 @@ # My Introduction to Hobby Programming -Here's the thing. I love programming. I know it's fun, interactive, and addictive, but it's hard to see that when you are looking through a pair of spectacles that sees the world ever-so-slightly differently than mine. For that reason, I feel I should start with my own introduction to the world of computer science, with the hope of inspiring you to share your own story. Full disclosure: this story is a decade old and involved linux. In fact, the open source community was one of the main reasons I ever became interested in hobby programming to begin with. Regardless, let's start at the start. +Here's the thing. I love programming. I know it's fun, interactive, and addictive, but it's hard to see that when you are looking through a pair of spectacles that sees the world ever-so-slightly differently than mine. For that reason, I feel I should start with my own introduction to the world of computer science, with the hope of inspiring you to share your own story. Full disclosure: this story is a decade old and involved Linux. In fact, the open source community was one of the main reasons I ever became interested in hobby programming to begin with. Regardless, let's start at the start. I don't know if you guys had a similar childhood to mine or not, but I found that no matter who I spoke to, there was one central theme in all of our lives -- something so fundamental to the way we communicated with each other that it was nearly impossible to have a discussion without bringing it up: **Video Games**. @@ -12,11 +12,11 @@ Being the curious kid I was, I asked what I should do to avoid Vista and they sa My friends could have just said, "It's the thing that operates your hardware. It brings up the UI elements and stuff you work with." Sure, it's not quite the whole story, but as a computer novice, it would have been just fine for me. That said, they took it a step further and said, "Nowadays, there are many operating systems to choose from, including Windows, Mac, and Linux." I may have been a complete novice, but I at least knew about Windows and Mac. Linux, though? What the heck was that? -Of course I asked about it, but this was early high school. My friends may have been smarter than I was, but there was a limit to their knowledge. Apparently, the only thing they knew about linux was that it was supposedly faster and couldn't catch viruses. That caught me. +Of course I asked about it, but this was early high school. My friends may have been smarter than I was, but there was a limit to their knowledge. Apparently, the only thing they knew about Linux was that it was supposedly faster and couldn't catch viruses. That caught me. Remember how I said I couldn't get the virus software to work on my computer? Yeah. At this point, I was thinking, *What? A computer that couldn't catch viruses? No way! That's gotta be **leagues** easier to use than Windows!* -*Oh ho* I was... well... I was downright naive. I had no idea what I was doing. That night, I ran home, super excited to learn about linux and operating systems, and spent the entire night browsing the internet, trying to find whatever information was out there. At the time, my google-fu was weak and my internet was slow. The first thing I learned was that there were apparently different types of linuxes called "distributions." At that point, I probably searched "What is the best linux?" or something to that effect. Somehow, I managed to find [distrowatch](https://distrowatch.com/), which had a list of all the most popular distros on the side. +*Oh ho* I was... well... I was downright naive. I had no idea what I was doing. That night, I ran home, super excited to learn about Linux and operating systems, and spent the entire night browsing the internet, trying to find whatever information was out there. At the time, my google-fu was weak and my internet was slow. The first thing I learned was that there were apparently different types of linuxes called "distributions." At that point, I probably searched "What is the best Linux?" or something to that effect. Somehow, I managed to find [distrowatch](https://distrowatch.com/), which had a list of all the most popular distros on the side. I don't remember the exact order, but I knew the key players were there: Ubuntu, Mint, Fedora, Debian, and Arch. Now, here's where my years of gaming experience came in. I personified each distribution as a class in a game world. Ubuntu was the easy to use axe-wielding warrior that would get the job done. Fedora was the Archer in the back with a feather in his cap and a quick quip for everything. Debian was the grandmotherly spellcaster just trying to keep everyone alive. Then there was Arch, the one who rushed into combat without any armor and uses only the environment as a weapon. @@ -36,7 +36,7 @@ In my head, I knew what this meant. I needed to create my username, right? So I **root** -Now, at the time, I didn't realize what I was doing. I didn't know that root was the god of my computer -- the user who decides all other user disputes. At the time, I thought it was an odd, quircky word chosen by the Arch developers in the same way they were talking about cheese graters before. I suppose that knowledge would come in time. At that moment, I was celebrating what might have been the most difficult thing I had done to that point in my life: typing in a 4 letter word. +Now, at the time, I didn't realize what I was doing. I didn't know that root was the god of my computer -- the user who decides all other user disputes. At the time, I thought it was an odd, quirky word chosen by the Arch developers in the same way they were talking about cheese graters before. I suppose that knowledge would come in time. At that moment, I was celebrating what might have been the most difficult thing I had done to that point in my life: typing in a 4 letter word. #### Step 3: The blue screen of death diff --git a/chapters/how_to_contribute.md b/chapters/how_to_contribute.md index 5b6d5276e..093a0a85c 100644 --- a/chapters/how_to_contribute.md +++ b/chapters/how_to_contribute.md @@ -2,10 +2,10 @@ The *Algorithm Archive* is an effort to learn about and teach algorithms as a community. As such, it requires a certain level of trust between community members. -For the most part, the collaboration can be done via github and gitbook, so it is important to understand the basics of [version control](principles_of_code/version_control.md). +For the most part, the collaboration can be done via GitHub and gitbook, so it is important to understand the basics of [version control](principles_of_code/version_control.md). Ideally, all code provided by the community will be submitted via pull requests and discussed accordingly; however, I understand that many individuals are new to collaborative projects, so I will allow submissions by other means (comments, tweets, etc...). As this project grows in size, it will be harder and harder to facilitate these submissions. -In addition, by submitting in any way other than pull requests, I cannot gaurantee I will be able to list you as a collaborator (though I will certainly do my best to update the `CONTRIBUTERS.md` file accordingly). +In addition, by submitting in any way other than pull requests, I cannot guarantee I will be able to list you as a collaborator (though I will certainly do my best to update the `CONTRIBUTORS.md` file accordingly). At this point, I am trying to figure out the best way to balance community contributions and text. Right now, I feel comfortable writing the text associated with each algorithm and asking for the community to write individual implementations. @@ -13,9 +13,9 @@ In the future, I might allow other users to write algorithm chapters, but for no Now for some specifics on submissions: 1. **Style**: Follow standard style guidelines associated with your language of choice. For C / C++, please use Stroustrup style, with `auto` used rarely or not at all. We have had plenty of discussions about this, which can be found [here](https://github.com/algorithm-archivists/algorithm-archive/issues/18). I will leave the issue open for now in the case that other individuals have more to contribute there. Basically, your code should be readable and understandable to anyone -- especially those who are new to the language. In addition, remember that your code will be displayed in this book, so try to keep to around 80 columns and try to remove any visual clutter. In addition, keep variable names clean and understandable. -2. **Licensing**: All the code from this project will be under the MIT licence found in `LICENCE.md`; however, the text will be under a Creative Commons Attribution-NonCommercial 4.0 International License. +2. **Licensing**: All the code from this project will be under the MIT license found in `LICENSE.md`; however, the text will be under a Creative Commons Attribution-NonCommercial 4.0 International License. 3. **CONTRIBUTORS.md**: After contributing code, please echo your name to the end of `CONTRIBUTORS.md` with `echo name >> CONTRIBUTORS.md`, and also leave a comment on the top of the code you submitted with your name (or username) saying `// submitted by name`. This way everyone is held accountable and we know who to contact if we want more information. -4. **Building the Algorithm Archive**: If you want to build the Algorithm Archive on your own machine, install gitbook and use `gitbook serve` in the main directory (where `README.md` is). This will provide a local url to go to to view the archive in your browser of choice. Use this server to make sure your version of the Algorithm Archive works cleanly for the chapter you are updating! +4. **Building the Algorithm Archive**: If you want to build the Algorithm Archive on your own machine, install gitbook and use `gitbook serve` in the main directory (where `README.md` is). This will provide a local URL to go to to view the archive in your browser of choice. Use this server to make sure your version of the Algorithm Archive works cleanly for the chapter you are updating! For this project, we allow submissions in every language. To submit code, simply go to the code directory of whatever chapter you want and add a directory for your language of choice. @@ -25,7 +25,7 @@ We need the following statements in the markdown file for these to work together [import](codeblock.txt) -For this example, we are starting the theme-api `method` and importing lines 1-17 from a sample julia snippet from the code directory. +For this example, we are starting the theme-api `method` and importing lines 1-17 from a sample Julia snippet from the code directory. Note that to standardize the language capitalization schemes, we ask that each language's `sample lang` is the file extension for their code, `cpp` for C++, `hs` for Haskell, etc... This keeps the title in the theme-api consistent across different languages. Also note that depending on the algorithm, there might be in-text code snippets that also need to be written. diff --git a/chapters/introduction.md b/chapters/introduction.md index 4904fdf01..c9e7158d6 100644 --- a/chapters/introduction.md +++ b/chapters/introduction.md @@ -2,7 +2,7 @@ People learn differently, there's no doubt about that. I for one, have never been able to follow a lecture. No matter how interesting the subject might be, the teacher or professor either moves too slowly or too quickly, and in both cases I lose the motivation to study and learn outside of class. Looking back at all my past lectures, this is a bit of a shame. I genuinely love learning! In fact, nowadays there's nothing I enjoy more than poring through the [ArXiv](https://arxiv.org/), looking for the latest and greatest algorithms in physics and computer science. Sure, I cannot *understand* them all, but sometimes it's nice to be completely overwhelmed and chip away at problems one piece at a time. In the end, modern research is a conglomeration of fun little (or big) puzzles to solve; however, I find that many papers are too harsh for most people to tackle without a significant background in computer science or physics. For this reason, they are ignored by the public. We live in an era where nearly the entire sum of human knowledge is available at our fingertips, and yet people are blissfully unaware of the unique ideas and challenges that are pushing our understanding forward. -I guess that is the point of this work. Throughout the past few years, I have been collecting small morsels of knowledge that are hard to express in any meaningful way through blog posts, youtube, or twitch streaming. Youtube, for example, is a great place to introduce the general idea of an algorithm; however, I personally find it a poor choice to show a worked example. Twitch is great to show everything, but spending 5 hours programming up an algorithm for the first time is generally not everyone's idea of fun. Blog posts work well for this type of material; however, they lack a comprehensive nature that I tend to enjoy. So what's left? Well, I suppose that would be a book, which is an incredibly exciting prospect! +I guess that is the point of this work. Throughout the past few years, I have been collecting small morsels of knowledge that are hard to express in any meaningful way through blog posts, YouTube, or twitch streaming. YouTube, for example, is a great place to introduce the general idea of an algorithm; however, I personally find it a poor choice to show a worked example. Twitch is great to show everything, but spending 5 hours programming up an algorithm for the first time is generally not everyone's idea of fun. Blog posts work well for this type of material; however, they lack a comprehensive nature that I tend to enjoy. So what's left? Well, I suppose that would be a book, which is an incredibly exciting prospect! See, when I was younger, maybe around Jr. High School age, I really wanted to become an author. I spent as much free time as I could manage writing fantastical stories about heroes and villains creating their own worlds and redefining reality. It was (and still is) an enjoyable hobby of mine. In many ways, my love of storytelling is echoed in my love of science and mathematics. In my mind, every discovery is its own story -- an adventure just waiting to be understood! It seems incredible to me that I now have the chance to combine my two favorite hobbies: writing and learning. @@ -12,7 +12,7 @@ This text is a natural extension of that idea -- a community effort to learn as For this reason, I hesitate to call this a work a "textbook" and would prefer to think of it as a lab notebook of sorts. It will be an archive filled with cool ideas in computer science and physics that I hope will be interesting in their own right. My hope is that this book perfectly straddles the line between comprehensiveness and pleasure and will be an enjoyable read for anyone at any stage on their hobby programming journey. -Keeping with the community theme, this book is freely available on [github](https://github.com/algorithm-archivists/algorithm-archive) and [github pages](https://www.algorithm-archive.org). Please feel free to read / browse the content available there. If you have any questions / comments / concerns, please let me know. This book is a community project and will only work if there is a community that works on it! +Keeping with the community theme, this book is freely available on [github](https://github.com/algorithm-archivists/algorithm-archive) and [GitHub pages](https://www.algorithm-archive.org). Please feel free to read / browse the content available there. If you have any questions / comments / concerns, please let me know. This book is a community project and will only work if there is a community that works on it! As a final note before beginning the bulk text, I would like for this book to be "language agnostic." This basically means that I would like to use psuedocode in the main text, but provide source code in any language you could want in the appendix. Though this may seem a little counter-intuitive, I think it offers the greatest flexibility for myself as the author and for the community to develop their own code in any way they please. In fact, if you feel inclined, please feel free to implement your own version of any algorithm mentioned in this text. If you submit it and it passes all my *ahem* rigorous tests, then I can throw it at the end of each chapter with attribution to you! diff --git a/chapters/monte_carlo/monte_carlo.md b/chapters/monte_carlo/monte_carlo.md index c819457eb..ef7d5e395 100644 --- a/chapters/monte_carlo/monte_carlo.md +++ b/chapters/monte_carlo/monte_carlo.md @@ -2,7 +2,7 @@ Monte Carlo methods were some of the first methods I ever used for research, and when I learned about them, they seemed like some sort of magic. Their premise is simple: random numbers can be used to integrate arbitrary shapes embedded into other objects. -Nowadays, "monte carlo" has become a bit of a catch-all term for methods that use random numbers to produce real results, but it all started as a straightforward method to integrate objects. +Nowadays, "Monte Carlo" has become a bit of a catch-all term for methods that use random numbers to produce real results, but it all started as a straightforward method to integrate objects. No matter how you slice it, the idea seems a bit crazy at first. After all, random numbers are random. How could they possibly be used to find non-random values? diff --git a/chapters/multiplication/multiplication.md b/chapters/multiplication/multiplication.md index e285d2300..d6b1abeec 100644 --- a/chapters/multiplication/multiplication.md +++ b/chapters/multiplication/multiplication.md @@ -13,7 +13,7 @@ Oh boy was I wrong. The Schönhage–Strassen algorithm was actually the most efficient method to multiply two numbers until around 2007 when it was dethroned by the Fürer's algorithm. Even so, the Schönhage–Strassen is still used in practice by the math libraries of many languages due to its straightforward implementation and a few other factors. -Here's the point: through time, computer science researchers have managed to take some of the simplist operations imaginable, overcomplicate them, and make them incredibly impressive. +Here's the point: through time, computer science researchers have managed to take some of the simplest operations imaginable, overcomplicate them, and make them incredibly impressive. Sometimes it's even worth looking at trivial operations through a new lens. diff --git a/chapters/physics_solvers/physics_solvers.md b/chapters/physics_solvers/physics_solvers.md index c5a6b0ae8..5c6777b22 100644 --- a/chapters/physics_solvers/physics_solvers.md +++ b/chapters/physics_solvers/physics_solvers.md @@ -6,4 +6,4 @@ In this section, we will place all algorithms and methods that are *specific* to It's worth noting that many algorithms used throughout the Archive can also be used to solve physics equations and physics lends itself more readily to computational methods than many other areas of scientific research, such as biology or chemistry. In the future, we may also place several unique physical systems along with different methods to solve these systems. -For example, there are many different ways to solve the Schrodinger equation, heat equation, kinematic equation and several other systems taht are unique to physics and there are benefits and drawbacks for solving certain physical systems in certain ways. +For example, there are many different ways to solve the Schrodinger equation, heat equation, kinematic equation and several other systems that are unique to physics and there are benefits and drawbacks for solving certain physical systems in certain ways. diff --git a/chapters/sorting_searching/sorting_searching.md b/chapters/sorting_searching/sorting_searching.md index 34f9542a2..06b5978c7 100644 --- a/chapters/sorting_searching/sorting_searching.md +++ b/chapters/sorting_searching/sorting_searching.md @@ -1,5 +1,5 @@ # Sorting and Searching -When it comes to algorithms that programmers know and love, the sterotypical examples are often algorithms that either sort or search through a given container of elements. +When it comes to algorithms that programmers know and love, the stereotypical examples are often algorithms that either sort or search through a given container of elements. For the most part, sorting and searching methods are two sides to the same coin and are almost always described together due to their similarities. To be honest, they are also good thought exercises for new programmers. It's often inspiring to hear how individuals who have no programming experience go about solving the problem, because there are so many ways to do it! diff --git a/chapters/tree_traversal/tree_traversal.md b/chapters/tree_traversal/tree_traversal.md index 32f995748..ebed88287 100644 --- a/chapters/tree_traversal/tree_traversal.md +++ b/chapters/tree_traversal/tree_traversal.md @@ -171,7 +171,7 @@ All this said, there are a few details about DFS that might not be idea, dependi

-And this is exactly what Breadth-First Search (BFS) does! On top of that, it can be implemented in the same way as the `DFS_stack(...)` function above, simply by swapping the `stack` for a `queue`, which is similar to a stack, exept that it only allows you to interact with the very first element instead of the last. In code, this looks something like: +And this is exactly what Breadth-First Search (BFS) does! On top of that, it can be implemented in the same way as the `DFS_stack(...)` function above, simply by swapping the `stack` for a `queue`, which is similar to a stack, except that it only allows you to interact with the very first element instead of the last. In code, this looks something like: {% method %} {% sample lang="jl" %}