Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(799)

Unified Diff: webkit/data/test_shell/sort/sort-heap.js

Issue 401923005: webkit: Remove all files from test_shell/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/data/test_shell/sort/sort-bubble.js ('k') | webkit/data/test_shell/sort/sort-insertion.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/data/test_shell/sort/sort-heap.js
diff --git a/webkit/data/test_shell/sort/sort-heap.js b/webkit/data/test_shell/sort/sort-heap.js
deleted file mode 100644
index 6a1bf5dc69af8dea27c1c98ea2dc09ace4b8432c..0000000000000000000000000000000000000000
--- a/webkit/data/test_shell/sort/sort-heap.js
+++ /dev/null
@@ -1,53 +0,0 @@
-// heapsort
-
-function sort_heap(sort, end) {
- if (arguments.length == 1) {
- var mid = Math.floor(sort.size/2 - 1);
- sort.add_work(function() { build_heap(sort, mid); }, "build_heap");
- } else if (end > 0) {
- sort.swap(end, 0);
- end--;
- sort.add_work(function() { sort_heap(sort, end); }, "sort_heap");
- sort.add_work(function() { sift_down(sort, 0, end, 0); }, "sift_down");
- }
-}
-
-function build_heap(sort, start) {
- if (start >= 0) {
- sort.add_work(function() { build_heap(sort, start-1); }, "build_heap");
- sort.add_work(function() { sift_down(sort, start, sort.size-1, start); },
- "sift_down");
- } else {
- sort.add_work(function() { sort_heap(sort, sort.size-1); },
- "sort_heap");
- }
-}
-
-function sift_down(sort, start, end, root) {
- var child = root * 2 + 1;
- if (child <= end) {
- if (child < end && sort.compare(child, child + 1) < 0) {
- child++;
- }
- if (sort.compare(root, child) < 0) {
- sort.swap(root, child);
- root = child;
- sort.add_work(function() { sift_down(sort, start, end, root); },
- "sift_down");
- }
- }
-}
-
-function validate_heap(sort) {
- var i = Math.floor(sort.size/2 - 1);
- while (i >= 0) {
- child = i * 2 + 1;
- if (sort.compare(i, child) < 0)
- return 0;
- if (child + 1 < sort.size)
- if (sort.compare(i, child + 1) < 0)
- return 0;
- i--;
- }
- return 1;
-}
« no previous file with comments | « webkit/data/test_shell/sort/sort-bubble.js ('k') | webkit/data/test_shell/sort/sort-insertion.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698