background preloader

Algorithms

Facebook Twitter

CS 97SI: Introduction to Competitive Programming Contests. Course Information and Announcements Instructor: Jaehyun Park (Stanford ACM-ICPC coach) Subscribe to the Stanford ACM-ICPC email list to get notifications about future practice contests.

CS 97SI: Introduction to Competitive Programming Contests

(Added on 8/21/2013) This class was taught in 2011-12 Winter. I'm getting a lot of emails asking if I'm teaching it again, but there is no plan to offer the course at the moment. (Added on 6/30/2015) All the slides are rewritten in LaTeX now. Lecture slides Practice Problems All the problems below are from Peking Online Judge (POJ). Common coding mistakes. Home of the world's largest development community. Algorithms and Data Structures. Algorithm: a process or set of rules used for calculation or problem-solving, esp. with a computer.Program: a series of coded instructions to control the operation of a computer or other machine.

Algorithms and Data Structures

Example Problem: Find the greatest common divisor (GCD) of two integers, m and n.Euclid's Algorithm: while m is greater than zero: If n is greater than m, swap m and n. Subtract n from m. n is the GCD Program (in C): Correctness Why do we believe that this algorithm devised thousands of years ago, is correct? Given m>0 and n>0, let g = gcd(m,n). So the algorithm is correct, provided that it terminates. Termination At the start of each iteration of the loop, either n>m or m≥n.

So the algorithm does terminate. Testing Having proved the algorithm to be correct, one might argue that there is no need to test it. Sorting Algorithm Animations. Algorithms in Java, Parts 1-4, 3rd edition by Robert Sedgewick. Addison Wesley, 2003. Quicksort is Optimal by Robert Sedgewick and Jon Bentley, Knuthfest, Stanford University, January, 2002. Dual Pivot Quicksort: Code by Discussion.

Bubble-sort with Hungarian (“Csángó”) folk dance YouTube video, created at Sapientia University, Tirgu Mures (Marosvásárhely), Romania. Select-sort with Gypsy folk dance YouTube video, created at Sapientia University, Tirgu Mures (Marosvásárhely), Romania. Sorting Out Sorting, Ronald M. Help the judge. All submissions for this problem are available.

Help the judge

A scandal has been revealed in the ruling political party: there is a large case of corruption! You are the judge in the case, and you have a lot of evidence at your disposal. Unfortunately, some of the statements may potentially contradict the others. Clever Algorithms in Python « Sai Panyam.NET. Overview Clever Algorithms in Python was born out of the need to understand and assimilate the original Clever Algorithms by Jason Brownlee.

Clever Algorithms in Python « Sai Panyam.NET

Please read about my motivations and goals here: Overview, Stochastic Algorithms – Part 1 & Part 2 Download Download source code. Unzip and import the attached folder in to your Eclipse workspace. Knapsack problem. Example of a one-dimensional (constraint) knapsack problem: which boxes should be chosen to maximize the amount of money while still keeping the overall weight under or equal to 15 kg?

Knapsack problem

A multiple constrained problem could consider both the weight and volume of the boxes. (Answer: if any number of each box is available, then three yellow boxes and three grey boxes; if only the shown boxes are available, then all but the green box.) KNAPSACK_01 - Data for the 01 Knapsack Problem. KNAPSACK_01 is a dataset directory which contains some examples of data for 01 Knapsack problems.

KNAPSACK_01 - Data for the 01 Knapsack Problem

In the 01 Knapsack problem, we are given a knapsack of fixed capacity C. We are also given a list of N objects, each having a weight W(I) and profit P(I). We can put any subset of the objects into the knapsack, as long as the total weight of our selection does not exceed C. Enterprise open Innovation. The Spirit Of Competition The [topcoder] community brings many of the world’s best talent together in one place to compete, collaborate and learn from one another.

Enterprise open Innovation

While competition is core to everything we do, its our collaborative community atmosphere that makes [topcoder] special. We compete together to make us all better practitioners of the technology we love. TopCoder. [topcoder] is a company which administers contests in computer programming.

TopCoder

[topcoder] hosts fortnightly online competitive programming competitions—known as SRMs or "single round matches"—as well as weekly competitions in design and development. The work in design and development produces useful software which is licensed for profit by [topcoder]. Competitors involved in the creation of these components are paid royalties based on these sales. The software resulting from algorithm competitions—and the less-frequent marathon matches—is not usually directly useful, but sponsor companies sometimes provide money to pay the victors. Introduction to Programming in Java: An Interdisciplinary Approach. A textbook for a first course in computer sciencefor the next generationof scientists and engineers Textbook.

Introduction to Programming in Java: An Interdisciplinary Approach

Our textbooks Introduction to Programming in Java [Amazon · Pearson · InformIT ] and Computer Science [Amazon · Pearson · InformIT ] are an interdisciplinary approach to the traditional CS1 curriculum with Java. We teach the classic elements of programming, using an "objects-in-the-middle" approach that emphasizes data abstraction. We motivate each concept by examining its impact on specific applications, taken from fields ranging from materials science to genomics to astrophysics to internet commerce. The first half of the book is organized around four stages of learning to program: Chapter 1: Elements of Programming introduces variables; assignment statements; built-in types of data; conditionals and loops; arrays; and input/output, including graphics and sound. Booksite. Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.