background preloader

Algorithm Tutorials

Algorithm Tutorials
Related:  Algorithmes&programmation

Programmation en Python pour les mathématiques Nous [1] venons de publier un ouvrage consacré à l’utilisation du langage Python en cours de mathématiques, du collège jusqu’aux premières années universitaires. Le langage universel n’existe pas et l’utilisation de Python pourra être mise en parallèle avec d’autres langages, notamment fonctionnels, qui éclairent d’autres pans des mathématiques que nous aimons enseigner. Ces dernières pourront être travaillées avec profit grâce à Python qui reste, tout en étant à la fois simple et clair, robuste et professionnel. Ce langage est largement répandu et illustre naturellement de nombreux concepts de notre matière. Pour poursuivre la réflexion sur les rapports entre le langage mathématique et les langages de programmation, on pourra lire cet article de Gilles Dowek Au moins deux pistes s’offrent à nous : illustrer de manière efficace et justifiée une notion mathématique à l’aide de l’outil informatique ou inversement, faire des mathématiques en explorant une notion informatique. #! #! Listes Python

Data structure Different kinds of data structures are suited to different kinds of applications, and some are highly specialized to specific tasks. For example, B-trees are particularly well-suited for implementation of databases, while compiler implementations usually use hash tables to look up identifiers. Data structures provide a means to manage large amounts of data efficiently, such as large databases and internet indexing services. Usually, efficient data structures are a key to designing efficient algorithms. Overview[edit] Many others are possible, but they tend to be further variations and compounds of the above. Basic principles[edit] The implementation of a data structure usually requires writing a set of procedures that create and manipulate instances of that structure. Language support[edit] Many known data structures have concurrent versions that allow multiple computing threads to access the data structure simultaneously. See also[edit] References[edit] Further reading[edit]

The DIY Kid-tracking Drone On school-day mornings, I walk my grade-school-age son 400 meters down the hill to the bus stop. Last winter, I fantasized about sitting at my computer while a camera-equipped drone followed him overhead. So this year, I set out to build one. For the basic airframe, I selected a quadcopter design for its maneuverability and ability to hover. On the mechanical side, there’s a central frame to hold the electronics, spars of aluminum to support the motors and propellers, and legs to cushion the quadcopter’s landing (I made a few extra sets of legs out of foam board for easy replacement). On the electronics side, there’s a main control board plus sensors, batteries, a power distribution board, power controllers for the motors (which draw tens of amperes, not what you’d manipulate with ordinary microcircuitry) and a radio receiver for standard remote-control flying, plus an RF modem for computerized control—I got both control systems for redundancy. So, did it work?

Algorithm Tutorials Geometry Concepts: Line Intersection and its Applications By lbackstromTopCoder Member ...read Section 1 Line-Line IntersectionFinding a Circle From 3 PointsReflectionRotationConvex Hull In the previous section we saw how to use vectors to solve geometry problems. Line-Line Intersection One of the most common tasks you will find in geometry problems is line intersection. double det = A1*B2 - A2*B1 if(det == 0){ //Lines are parallel }else{ double x = (B2*C1 - B1*C2)/det double y = (A1*C2 - A2*C1)/det } To see where this comes from, consider multiplying the top equation by B2, and the bottom equation by B1. This gives you the location of the intersection of two lines, but what if you have line segments, not lines. Finding a Circle From 3 Points Given 3 points which are not colinear (all on the same line) those three points uniquely define a circle. To find the perpendicular bisector of XY, find the line from X to Y, in the form Ax+By=C. ...continue to Section 3

Python Course: Tutorial, Reference and Advanced Topics Category:Data structures In computer science, a data structure is a way of storing data in a computer so that it can be used efficiently. Often a carefully chosen data structure will allow a more efficient algorithm to be used. The choice of the data structure must begin from the choice of an abstract data structure. Subcategories This category has the following 13 subcategories, out of 13 total. Pages in category "Data structures" The following 43 pages are in this category, out of 43 total.

OverAPI.com | Collecting all the cheat sheets Algorithm Tutorials Line Sweep Algorithms By bmerryTopCoder Member A previous series of articles covered the basic tools of computational geometry. In several places I'll refer to the Euclidean and Manhattan distances. In addition, a balanced binary tree is used in some of the algorithms. Closest pair Given a set of points, find the pair that is closest (with either metric). Suppose that we have processed points 1 to N − 1 (ordered by X) and the shortest distance we have found so far is h. To search for points closer than h to point N, we need only consider points in the active set, and furthermore we need only consider points whose y coordinates are in the range yN − h to yN + h (those in the dark grey rectangle). Line segment intersections We'll start by considering the problem of returning all intersections in a set of horizontal and vertical line segments. event : an X coordinate at which something interesting happens. active set Convex hull The convex hull The black path shows the current hull. BoxUnion A.

Python Course: Introduction into the Sys Module Information on the Python Interpreter Like all the other modules, the sys module has to be imported with the import statement, i.e. import sys If there are questions about the import statement, we recommend the introductory chapter of our basic course concerning this topic Modular Programming and Modules The sys module provides information about constants, functions and methods of the Python interpreter. dir(system) gives a summary of the available constants, functions and methods. Another possibility is the help() function. The module sys informs e.g. about the maximal recursion depth (sys.getrecursionlimit() ) and provides the possibility to change ist (sys.setrecursionlimit()) The current version number of Python can be accessed as well: >>> import sys >>> sys.version '2.6.5 (r265:79063, Apr 16 2010, 13:57:41) \n[GCC 4.4.3]' >>> sys.version_info (2, 6, 5, 'final', 0) >>> Command-line arguments #! We save this script as arguments.py. Standard data streams $ python streams.py < numbers.txt

Bitwise operations Bitwise operators include: AND OR and XOR These require two operands and will perform bit comparisions. AND & will copy a bit to the result if it exists in both operands. OR | will copy a bit if it exists in eather operand. XOR ^ copies the bit if it is set in one operand (but not both). XOR example program which swaps the contents of two variables. Try it out with one of these simulators. Ones Complement This operator is unary (requires one operand) and has the efect of 'flipping' bits. Try it out Bit shift. The following operators can be used for shifting bits left or right. The left operands value is moved left or right by the number of bits specified by the right operand. Usually, the resulting 'empty' bit is assigned ZERO. Try it out with one of these silulators Examples: Bit shifting. Problem: Bit shifting problem. See Also: All the other Expressions and operators. Operator precedence. Assignment Operators.

Liste des algorithmes La liste complète de tous les principaux algorithmes (300), dans tous les domaines. Avec pour but de fournir un programme prêt à tourner pour chacun, ou une description de l'algorithme. Les langages de programmation incluent Java, JavaScript, et PHP, C ou C++ soit sous forme directe, soit générés à partir d'un source en Scriptol. Automate Powerset construction. Bioinformatique et chémoinformatique Needleman-Wunsch. Compression Compression sans perte Burrows-Wheeler transform. Codage par entropie Principe d'encodage qui assigne des codes aux symboles de sorte que la longueur des codes corresponde à la probabilité des symboles. Huffman coding. Compression avec perte d'information Linear predictive coding. Cryptographie Cryptage à clé secrète (symétrique) Utilise une clé secrète (ou une paire de clés directement liées), à la fois pour l'encryptage et le décryptage. Cryptage à clé publique (asymétrique) Utilise une paire de clés, dites clé publique et clé privée. Générateur de code de contrôle Voir.

Related: