
sortvis.org - bitonicsort sortvis.org sorting algorithm visualisation bitonicsort drag to pan, scroll to zoom, view raw code import mathASCENDING = TrueDESCENDING = False def compare(lst, i, j, dir): if dir == (lst[i] > lst[j]): lst[i], lst[j] = lst[j], lst[i] lst.log() def merge(lst, lo, n, dir): if n > 1: k = n/2 for i in range(lo, lo+k): compare(lst, i, i+k, dir) merge(lst, lo, k, dir) merge(lst, lo+k, k, dir) def _bitonicsort(lst, lo, n, dir): if n > 1: k = n/2 _bitonicsort(lst, lo, k, ASCENDING) _bitonicsort(lst, lo+k, k, DESCENDING) merge(lst, lo, n, dir) def bitonicsort(lst): # Length of list must be 2**x, where x is an integer. assert math.modf(math.log(len(lst), 2))[0] == 0 _bitonicsort(lst, 0, len(lst), ASCENDING) List order is sampled for visualisation whenever lst.log() is called. Copyright 2010 Aldo Cortesi
sorting.html VisuAlgo was conceptualised in 2011 by Dr Steven Halim as a tool to help his students better understand data structures and algorithms, by allowing them to learn the basics on their own and at their own pace. VisuAlgo contains many advanced algorithms that are discussed in Dr Steven Halim's book ('Competitive Programming', co-authored with his brother Dr Felix Halim) and beyond. Today, some of these advanced algorithms visualization/animation can only be found in VisuAlgo. Though specifically designed for NUS students taking various data structure and algorithm classes (e.g. VisuAlgo is not designed to work well on small touch screens (e.g. smartphones) from the outset due to the need to cater for many complex algorithm visualizations that require lots of pixels and click-and-drag gestures for interaction. VisuAlgo is an ongoing project and more complex visualisations are still being developed. The training mode currently contains questions for 12 visualization modules.
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. Cache algorithms This article is about general cache algorithms. For detailed algorithms specific to paging, see Page replacement algorithm. For detailed algorithms specific to the cache between a CPU and RAM, see CPU cache. Overview[edit] The average memory reference time is[1] where = average memory reference time = miss ratio = 1 - (hit ratio) = time to make a main memory access when there is a miss (or, with multi-level cache, average memory reference time for the next-lower cache) = the latency: the time to reference the cache when there is a hit = various secondary effects, such as queuing effects in multiprocessor systems There are two primary figures of merit of a cache: The latency, and the hit rate. The "hit ratio" of a cache describes how often a searched-for item is actually found in the cache. The "latency" of a cache describes how long after requesting a desired item the cache can return that item (when there is a hit). Each replacement strategy is a compromise between hit rate and latency.