Eternally Confuzzled - AVL Tree Tutorial. By Julienne WalkerLicense: Public Domain New programmers who are introduced to binary search trees quickly learn that if items are inserted in certain orders, the performance of the tree degenerates into that of a glorified linked list.

Many brain cells have been devoted to the task of finding efficient ways to avoid these worst cases. Many exceedingly clever solutions have been developed, but only a handful have made it into public knowledge and even fewer into common use. Of those solutions, height balanced trees are the most common, and the AVL tree is probably the oldest of the height balanced trees. This tutorial will cover, often in painful detail, the concept behind AVL trees and implementation issues with a practical eye. If you are a struggling professional, or an amateur looking to broaden your skills, look no further. I talk about the impenetrable code of papers and textbooks, but there are many who would call my own approach impenetrable as well. 1 5 < 11 == 1 /* Wrong!

Researchers defeat CAPTCHA on popular websites. IDG News Service - Researchers from Stanford University have developed an automated tool that is capable of deciphering text-based anti-spam tests used by many popular websites with a significant degree of accuracy.

Researchers Elie Bursztein, Matthieu Martin and John C. Mitchel presented the results of their year-and-a-half long CAPTCHA study at the recent ACM Conference On Computer and Communication Security in Chicago. Researchers make weak passwords strong with CAPTCHAs plus an algorithm CAPTCHA stands for 'Completely Automated Public Turing test to tell Computers and Humans Apart' and consists of challenges that only humans are supposed to be capable of solving. Websites use such tests in order to block spam bots that automate tasks like account registration and comment posting. There are various types of CAPTCHAs, some using audio, others using math problems, but the most common implementations rely on users typing back distorted text.

Darts, Dice, and Coins. Processing math: 47% Preliminaries Before I go into any of the specific details of the different techniques, let's first standardize our notation and terminology.

In the introduction to this writeup, I used the term "loaded die" to describe a general scenario where there are is a finite set of outcomes, each of which has some associated probability. Formally, this is termed a discrete probability distribution, and the problem of simulating the loaded die is called sampling from a discrete distribution.

To describe our discrete probability distribution (loaded die), we will assume that we are given a set of n probabilities p_0, p_1, ..., p_{n - 1} associated with outcomes 0, 1, ..., n - 1. Dealing with real numbers on a computer is a bit of computation gray area. In what follows, I will assume that all of the following operations can be done in constant time: Addition, subtraction, multiplication, division, and comparison of arbitrary real numbers. Data Structure Visualization. Dictionary of Algorithms and Data Structures. Sorting Algorithms Demo. We all know that Quicksort is one of the fastest algorithms for sorting.

It's not often, however, that we get a chance to see exactly how fast Quicksort really is. The following applets chart the progress of several common sorting algorithms while sorting an array of data using in-place algorithms. This means that the algorithms do not allocate additional storage to hold temporary results: they sort the data in place.

(This is inspired by the algorithm animation work at Brown University and the video Sorting out Sorting By Ronald Baecker from the University of Toronto (circa 1970!).) Some of these sorts are very stupid or very slow and should not be used in code. In-Place Mergesort is yet another abomination. New: Radix sort by Alvin Raj, August 13, 2002. Click on each applet to see the algorithm run.Click on the name of the algorithm to see the source. Bubble Sort (by James Gosling and Jason Harrison) Bi-Directional Bubble Sort (by James Gosling) 一些重要的算法. 下面是一些比较重要的算法，原文罗列了32个，但我觉得有很多是数论里的，和计算机的不相干，所以没有选取。

下面的这些，有的我们经常在用，有的基本不用。 有的很常见，有的很偏。 不过了解一下也是好事。 也欢迎你留下你觉得有意义的算法。 （注：本篇文章并非翻译，其中的算法描述大部份摘自Wikipedia，因为维基百科描述的很专业了） 附录 欢迎关注CoolShell微信公众账号. A Notebook: Elevator Algorithms. In Philadelphia, I spent a lot of time waiting for elevators.

I inevitably paid a lot of attention to the control algorithms used by different elevators in different buildings. All elevator algorithms solve the same type of optimization problem: given that a building has n floors and m elevators, how could we most efficiently move people up/down the floors? I'm sure you already know of the simple algorithm that every elevator implements, but one can definitely improve on this.

Here's one improvement someone tried to make. Example #1: This building has one elevator, and 8 floors. This is an intuitive solution. Example #2: There are no more than 10 floors (I believe it was less), and about 6 elevators. This speeds things up a lot. The algorithm used in example #2 focuses a lot more on people going up as compared to people going down. Example #3: This building has two elevators and ~12 floors.