Monday, August 11, 2014

If the two sets are arranged in the same order if (just like above) is more efficient this way spea


I than the algorithm to create the problem coming up to read a book lying down algorithm to determine whether the set A is a subset of B seen transferred to AS3.0. The turning for the door twice briefly. One'll compare the haebomyeon. This way, speaking. var aAry: Array = [1, 2, 6, 8, 12]; var bAry: Array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; function subset (a: Array, b: Array): Boolean {var alen: int = aAry.length; var blen: int = bAry.length; var t: int = 0; for (var i: int = 0; i <alen; i ++) {for (var k: int = 0; k <blen; k ++) {trace (t ++); if (a [i] == b [k]) {break; } If (k == blen -1) {return false; }}} Return true; } Trace (subset (aAry, bAry)); // t 33 times
If the two sets are arranged in the same order if (just like above) is more efficient this way speaking. var aAry: Array = [1, 2, 6, 8, 12]; var bAry: Array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; function subset (a: Array, b: Array): chilis Boolean {var alen: int = aAry.length; var blen: int = bAry.length; var startIndex: int = 0; var t: int = 0; for (var i: int = 0; i <alen; i ++) {for (var k: int = startIndex; k <blen; k ++) {trace (t ++); if (a [i] == b [k]) {startIndex = k; break; } If (k == blen -1) {return false; }}} Return true; } Trace (subset (aAry, bAry)); // t 16 times
Nike
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> chilis <b> <blockquote cite=""> <cite> <code> <del datetime = ""> <em> <i> <q cite = ""> <strike> <strong>
August 2014 SMTWTFS May 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Meta Register Log in Entries RSS Comments RSS WordPress.org
by powered

No comments:

Post a Comment