background preloader

Algos

Facebook Twitter

Fisher–Yates Shuffle. Say you had a fresh pack of cards: If you want to play a game of Texas Hold ‘em with friends, you should shuffle the deck first to randomize the order and insure a fair game.

Fisher–Yates Shuffle

But how? A simple but effective way of doing this is to pull a random card from the deck repeatedly and set it aside, incrementally building a new stack. As long as you pick each remaining card from the deck with equal probability, you’ll have a perfectly-unbiased random stack when you’re done: But let’s say instead of a physical deck of cards, you wanted to write code to perform this same task with an in-memory array of n elements. One slow option—gotta start somewhere: pick a random element from the array (in [0, n - 1]) and then check if you’ve shuffled that element already. Here’s what the implementation looks like in JavaScript, not that you should use it: Data Structure Visualization. Data Structure Visualization. Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.

Quaternions. This page is an introduction to Quaternions, the pages below this have more detail about their algebra and how to use them to represent 3D rotations.

Quaternions

Introduction Quaternions were discovered on 16 October 1843 by William Rowan Hamilton. He spent years trying to find a three dimensional number systems, but with no success, when he looked in 4 dimensions instead of 3 it worked. Quaternions form an interesting algebra where each object contains 4 scalar variables (sometimes known as Euler Parameters not to be confused with Euler angles), these objects can be added and multiplied as a single unit in a similar way to the usual algebra of numbers.

Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne. Introduction to Algorithms. Table of Contents I Foundations Introduction 3 1 The Role of Algorithms in Computing 5 1.1 Algorithms 5 1.2 Algorithms as a technology 11 2 Getting Started 16 2.1 Insertion sort 16 2.2 Analyzing algorithms 23 2.3 Designing algorithms 29.

Introduction to Algorithms

Lecture Slides for Algorithm Design by Jon Kleinberg And Éva Tardos. Cours informatique de haut niveau en ligne - Formation informatique. Octave. GNU Octave is a high-level interpreted language, primarily intended for numerical computations.

Octave

It provides capabilities for the numerical solution of linear and nonlinear problems, and for performing other numerical experiments. It also provides extensive graphics capabilities for data visualization and manipulation. Octave is normally used through its interactive command line interface, but it can also be used to write non-interactive programs. The Octave language is quite similar to Matlab so that most programs are easily portable. Octave is distributed under the terms of the GNU General Public License. Version 4.0.0 has been released and is now available for download. An official Windows binary installer is also available from A list of important user-visible changes is availble at by selecting the Release Notes item in the News menu of the GUI, or by typing news at the Octave command prompt. Public Domain Aeronautical Software (PDAS) Bit Twiddling Hacks.

By Sean Eron Anderson seander@cs.stanford.edu Individually, the code snippets here are in the public domain (unless otherwise noted) — feel free to use them however you please.

Bit Twiddling Hacks

The aggregate collection and descriptions are © 1997-2005 Sean Eron Anderson. The code and descriptions are distributed in the hope that they will be useful, but WITHOUT ANY WARRANTY and without even the implied warranty of merchantability or fitness for a particular purpose. As of May 5, 2005, all the code has been tested thoroughly. Thousands of people have read it. Contents About the operation counting methodology. Essential Math for Games Programmers. As the quality of games has improved, more attention has been given to all aspects of a game to increase the feeling of reality during gameplay and distinguish it from its competitors.

Essential Math for Games Programmers

Mathematics provides much of the groundwork for this improvement in realism. And a large part of this improvement is due to the addition of physical simulation. Creating such a simulation may appear to be a daunting task, but given the right background it is not too difficult, and can add a great deal of realism to animation systems, and interactions between avatars and the world. This tutorial deepens the approach of the previous years' Essential Math for Games Programmers, by spending one day on general math topics, and one day focusing in on the topic of physical simulation.

It, like the previous tutorials, provides a toolbox of techniques for programmers, with references and links for those looking for more information. Topics for the various incarnations of this tutorial can be found below. Slides. Big-O Algorithm Complexity Cheat Sheet. Statistical Formulas For Programmers. By Evan Miller DRAFT: May 19, 2013 Being able to apply statistics is like having a secret superpower.

Statistical Formulas For Programmers

Where most people see averages, you see confidence intervals. Algorithms. Eulerian Video Magnification. Banner slider Many seemingly static scenes contain subtle changes that are invisible to the naked human eye.

Eulerian Video Magnification

However, it is possible to pull out these small changes from videos through the use of algorithms we have developed. We give a way to visualize these small changes by amplifying them and we present algorithms to pull out interesting signals from these videos, such as the human pulse, sound from vibrating objects and the motion of hot air. Videos. Scientists Uncover Invisible Motion in Video.