## Merge Sort

### November 10, 2009

It is awkward to sort arrays by merge sort, since it requires two arrays, an input array and an output array; merge sort is used far more often to sort linked lists, as in the Standard Prelude. We begin with a function that merges two sub-arrays, `left` through `middle` and `middle + 1` through `right`, from an input array into the positions `left` through `right` in an output array:

```function merge(A,left,middle,right,    B,i,j,k) {     i = left; j = middle + 1     while (i <= middle && j <= right)         if (A[i] <= A[j]) B[++k] = A[i++]         else B[++k] = A[j++]     while (i <= middle)         B[++k] = A[i++]     while (j <= right)         B[++k] = A[j++]     for (k = left; k <= right; k++) {         A[k] = B[k]; delete B[k] } }```

Here `i` indexes the first sub-array, `j` indexes the second sub-array, and `k` indexes the output array; we take advantage of Awk’s implicit initialization for `k = 0`. The first `while` loop runs until one of the sequences ends, the second and third `while` loops pick up the remainders of the runs, and the fourth `while` loop copies the output array back to the input array. Notice that we broke our convention, using less-than-or-equal instead of less-than to compare array elements; doing so allows our sort to be stable, with equal elements appearing in the output in the same order as the input.

Given `merge`, the actual `sort` function splits the array in two, sorts the two halves recursively, then merges them together:

```function mergesort(A,left,right,    middle) {     if (left < right) {         middle = int((left + right) / 2)         mergesort(A, left, middle)         mergesort(A, middle + 1, right)         merge(A, left, middle, right) } }```

`function sort(A,n) { mergesort(A, 1, n) }`

``` If you like, you can move the merge inline and eliminate recursion; l1 and l2 index the lower bounds of the two sub-arrays, u1 and u2 index the upper bounds of the two sub-arrays, k indexes the output array, and g is the gap between the two sub-arrays, which doubles at each pass: function sort(A,n,    l1,l2,u1,u2,k,g,B) {     for (g = 1; g < n; g *= 2) {         k = 0         for (l1 = 1; l1 + g <= n; l1 = u2 + 1) {             l2 = l1 + g; u1 = l2 - 1             u2 = l2 + g - 1; if (u2 > n) u2 = n             while (l1 <= u1 && l2 <= u2)                 if (A[l1] <= A[l2])                     B[++k] = A[l1++]                 else B[++k] = A[l2++]             while (l1 <= u1)                 B[++k] = A[l1++]             while (l2 <= u2)                 B[++k] = A[l2++] }         while (k < n)             B[++k] = A[l1++]         for (k = 1; k <= n; k++)             A[k] = B[k] } } All of the code, including the test suite of the prior exercise, is collected at http://programmingpraxis.codepad.org/Wk6rsu1Z, but you can't run it because codepad doesn't provide an Awk interpreter. __ATA.cmd.push(function() { __ATA.initVideoSlot('atatags-370373-62f3063ecb455', { sectionId: '370373', format: 'inread' }); }); Share this:TwitterFacebookLike this:Like Loading... Related Pages: 1 2 ```
``` Posted by programmingpraxis Filed in Exercises 2 Comments » ```
``` 2 Responses to “Merge Sort” r. clayton said November 20, 2009 at 2:48 AM An idiotically cumbersome Java mergesort implementation. The private mergesort returns a pointer to the fully sorted (unsegmented) array. Vikas Tandi said April 30, 2011 at 8:36 AM My implementation in C #define MODCOPY(x,y) (((x) < 0) ? ((x) = (-y)) : ((x) = (y))) typedef struct ElementNode { int key; int link; }element; static void mergesort_imp(element arr[], int left, int right); static void swap(element arr[], int i, int j); void mergesort(element arr[], int left, int right) { int p, q, k; /* arrange the links in sorted order */ mergesort_imp(arr, left, right); /* sort the records in-place according to the links */ p = left-1; k = left; while(arr[p].link) { if(p < k) { p = arr[p].link; continue; } swap(arr, k, p); q = arr[k].link; arr[k].link = p; p = q; k++; } } /* arr[left-1] and arr[right+1] are two artificial nodes at the start and the end of list. A negative link denotes the end of a sublist known to be ordered; a zero link indicates the end of the entire list */ static void mergesort_imp(element arr[], int left, int right) { int i; int s, t , p, q; /* prepare two lists */ arr[left-1].link = left; arr[right+1].link = left+1; /* initially the file is assumed to be unordered, so setting all links to negative value */ for(i = left; i < (right-1); i++) arr[i].link = -(i+2); arr[right-1].link = 0; arr[right].link = 0; /* we have created two lists out of which one list contain all odd positioned elements and other list contain all even positioned elements */ /* main loop */ for(;;) { /* begin new pass */ s = left-1; t = right+1; p = arr[s].link; q = arr[right+1].link; if(q == 0) /* terminate */ break; for(;;) { /* compare keys */ if(arr[p].key > arr[q].key) { MODCOPY(arr[s].link, q); s = q; q = arr[q].link; if(q <= 0) { arr[s].link = p; s = t; do { t = p; p = arr[p].link; } while(p > 0); p = -p; q = -q; } } else { MODCOPY(arr[s].link, p); s = p; p = arr[p].link; if(p <= 0) { arr[s].link = q; s = t; do { t = q; q = arr[q].link; } while(q > 0); p = -p; q = -q; } } if(q == 0) break; } MODCOPY(arr[s].link, p); MODCOPY(arr[t].link, 0); } } static void swap(element arr[], int i, int j) { element temp; temp.key = arr[i].key; temp.link = arr[i].link; arr[i].key = arr[j].key; arr[i].link = arr[j].link; arr[j].key = temp.key; arr[j].link = temp.link; } Leave a Reply Enter your comment here... Fill in your details below or click an icon to log in: Email (required) (Address never made public) Name (required) Website You are commenting using your WordPress.com account. ( Log Out /  Change ) You are commenting using your Twitter account. ( Log Out /  Change ) You are commenting using your Facebook account. ( Log Out /  Change ) Cancel Connecting to %s var highlander_expando_javascript = function () { function hide( sel ) { var el = document.querySelector( sel ); if ( el ) { el.style.setProperty( 'display', 'none' ); } } function show( sel ) { var el = document.querySelector( sel ); if ( el ) { el.style.removeProperty( 'display' ); } } var input = document.createElement( 'input' ); var comment = document.querySelector( '#comment' ); if ( input && comment && 'placeholder' in input ) { var label = document.querySelector( '.comment-textarea label' ); if ( label ) { var text = label.textContent; label.parentNode.removeChild( label ); comment.setAttribute( 'placeholder', text ); } } // Expando Mode: start small, then auto-resize on first click + text length hide( '#comment-form-identity' ); hide( '#comment-form-subscribe' ); hide( '#commentform .form-submit' ); if ( comment ) { comment.style.height = '10px'; var handler = function () { comment.style.height = HighlanderComments.initialHeight + 'px'; show( '#comment-form-identity' ); show( '#comment-form-subscribe' ); show( '#commentform .form-submit' ); HighlanderComments.resizeCallback(); comment.removeEventListener( 'focus', handler ); }; comment.addEventListener( 'focus', handler ); } } if ( document.readyState !== 'loading' ) { highlander_expando_javascript(); } else { document.addEventListener( 'DOMContentLoaded', highlander_expando_javascript ); } Notify me of new comments via email. Notify me of new posts via email. Δdocument.getElementById( "ak_js_1" ).setAttribute( "value", ( new Date() ).getTime() ); ```
``` Categories Administrivia Exercises Archives December 2021 November 2021 October 2021 September 2021 June 2021 May 2021 April 2021 March 2021 February 2021 January 2021 December 2020 November 2020 October 2020 September 2020 August 2020 July 2020 June 2020 May 2020 April 2020 March 2020 February 2020 January 2020 December 2019 November 2019 October 2019 September 2019 August 2019 July 2019 June 2019 May 2019 April 2019 March 2019 February 2019 January 2019 November 2018 October 2018 September 2018 August 2018 July 2018 June 2018 May 2018 April 2018 March 2018 February 2018 January 2018 December 2017 November 2017 October 2017 September 2017 August 2017 July 2017 June 2017 May 2017 April 2017 March 2017 February 2017 January 2017 December 2016 November 2016 October 2016 September 2016 August 2016 July 2016 June 2016 May 2016 April 2016 March 2016 February 2016 January 2016 December 2015 November 2015 October 2015 September 2015 August 2015 July 2015 June 2015 May 2015 April 2015 March 2015 February 2015 January 2015 December 2014 November 2014 October 2014 September 2014 August 2014 July 2014 June 2014 May 2014 April 2014 March 2014 February 2014 January 2014 December 2013 November 2013 October 2013 September 2013 August 2013 July 2013 June 2013 May 2013 April 2013 March 2013 February 2013 January 2013 December 2012 November 2012 October 2012 September 2012 August 2012 July 2012 June 2012 May 2012 April 2012 March 2012 February 2012 January 2012 December 2011 November 2011 October 2011 September 2011 August 2011 July 2011 June 2011 May 2011 April 2011 March 2011 February 2011 January 2011 December 2010 November 2010 October 2010 September 2010 August 2010 July 2010 June 2010 May 2010 April 2010 March 2010 February 2010 January 2010 December 2009 November 2009 October 2009 September 2009 August 2009 July 2009 June 2009 May 2009 April 2009 March 2009 February 2009 November 2009 S M T W T F S 1234567 891011121314 15161718192021 22232425262728 2930   « Oct   Dec » Archives December 2021 November 2021 October 2021 September 2021 June 2021 May 2021 April 2021 March 2021 February 2021 January 2021 December 2020 November 2020 October 2020 September 2020 August 2020 July 2020 June 2020 May 2020 April 2020 March 2020 February 2020 January 2020 December 2019 November 2019 October 2019 September 2019 August 2019 July 2019 June 2019 May 2019 April 2019 March 2019 February 2019 January 2019 November 2018 October 2018 September 2018 August 2018 July 2018 June 2018 May 2018 April 2018 March 2018 February 2018 January 2018 December 2017 November 2017 October 2017 September 2017 August 2017 July 2017 June 2017 May 2017 April 2017 March 2017 February 2017 January 2017 December 2016 November 2016 October 2016 September 2016 August 2016 July 2016 June 2016 May 2016 April 2016 March 2016 February 2016 January 2016 December 2015 November 2015 October 2015 September 2015 August 2015 July 2015 June 2015 May 2015 April 2015 March 2015 February 2015 January 2015 December 2014 November 2014 October 2014 September 2014 August 2014 July 2014 June 2014 May 2014 April 2014 March 2014 February 2014 January 2014 December 2013 November 2013 October 2013 September 2013 August 2013 July 2013 June 2013 May 2013 April 2013 March 2013 February 2013 January 2013 December 2012 November 2012 October 2012 September 2012 August 2012 July 2012 June 2012 May 2012 April 2012 March 2012 February 2012 January 2012 December 2011 November 2011 October 2011 September 2011 August 2011 July 2011 June 2011 May 2011 April 2011 March 2011 February 2011 January 2011 December 2010 November 2010 October 2010 September 2010 August 2010 July 2010 June 2010 May 2010 April 2010 March 2010 February 2010 January 2010 December 2009 November 2009 October 2009 September 2009 August 2009 July 2009 June 2009 May 2009 April 2009 March 2009 February 2009 Blogroll WordPress.com WordPress.org ```
``` Blog at WordPress.com. var HighlanderComments = {"loggingInText":"Logging In\u2026","submittingText":"Posting Comment\u2026","postCommentText":"Post Comment","connectingToText":"Connecting to %s","commentingAsText":"%1\$s: You are commenting using your %2\$s account.","logoutText":"Log Out","loginText":"Log In","connectURL":"https:\/\/programmingpraxis.wordpress.com\/public.api\/connect\/?action=request&domain=programmingpraxis.com","logoutURL":"https:\/\/programmingpraxis.wordpress.com\/wp-login.php?action=logout&_wpnonce=618318587c","homeURL":"https:\/\/programmingpraxis.com\/","postID":"1602","gravDefault":"blank","enterACommentError":"Please enter a comment","enterEmailError":"Please enter your email address here","invalidEmailError":"Invalid email address","enterAuthorError":"Please enter your name here","gravatarFromEmail":"This picture will show whenever you leave a comment. Click to customize it.","logInToExternalAccount":"Log in to use details from one of these accounts.","change":"Change","changeAccount":"Change Account","comment_registration":"","userIsLoggedIn":"","isJetpack":"","text_direction":"ltr"}; ( function () { var setupPrivacy = function() { // Minimal Mozilla Cookie library // https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie/Simple_document.cookie_framework var cookieLib = window.cookieLib = {getItem:function(e){return e&&decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(e).replace(/[\-\.\+\*]/g,"\\\$&")+"\\s*\\=\\s*([^;]*).*\$)|^.*\$"),"\$1"))||null},setItem:function(e,o,n,t,r,i){if(!e||/^(?:expires|max\-age|path|domain|secure)\$/i.test(e))return!1;var c="";if(n)switch(n.constructor){case Number:c=n===1/0?"; expires=Fri, 31 Dec 9999 23:59:59 GMT":"; max-age="+n;break;case String:c="; expires="+n;break;case Date:c="; expires="+n.toUTCString()}return"rootDomain"!==r&&".rootDomain"!==r||(r=(".rootDomain"===r?".":"")+document.location.hostname.split(".").slice(-2).join(".")),document.cookie=encodeURIComponent(e)+"="+encodeURIComponent(o)+c+(r?"; domain="+r:"")+(t?"; path="+t:"")+(i?"; secure":""),!0}}; // Implement IAB USP API. window.__uspapi = function( command, version, callback ) { // Validate callback. if ( typeof callback !== 'function' ) { return; } // Validate the given command. if ( command !== 'getUSPData' || version !== 1 ) { callback( null, false ); return; } // Check for GPC. If set, override any stored cookie. if ( navigator.globalPrivacyControl ) { callback( { version: 1, uspString: '1YYN' }, true ); return; } // Check for cookie. var consent = cookieLib.getItem( 'usprivacy' ); // Invalid cookie. if ( null === consent ) { callback( null, false ); return; } // Everything checks out. Fire the provided callback with the consent data. callback( { version: 1, uspString: consent }, true ); }; // Initialization. document.addEventListener( 'DOMContentLoaded', function() { // Internal functions. var setDefaultOptInCookie = function() { var value = '1YNN'; var domain = '.wordpress.com' === location.hostname.slice( -14 ) ? '.rootDomain' : location.hostname; cookieLib.setItem( 'usprivacy', value, 365 * 24 * 60 * 60, '/', domain ); }; var setDefaultOptOutCookie = function() { var value = '1YYN'; var domain = '.wordpress.com' === location.hostname.slice( -14 ) ? '.rootDomain' : location.hostname; cookieLib.setItem( 'usprivacy', value, 24 * 60 * 60, '/', domain ); }; var setDefaultNotApplicableCookie = function() { var value = '1---'; var domain = '.wordpress.com' === location.hostname.slice( -14 ) ? '.rootDomain' : location.hostname; cookieLib.setItem( 'usprivacy', value, 24 * 60 * 60, '/', domain ); }; var setCcpaAppliesCookie = function( applies ) { var domain = '.wordpress.com' === location.hostname.slice( -14 ) ? '.rootDomain' : location.hostname; cookieLib.setItem( 'ccpa_applies', applies, 24 * 60 * 60, '/', domain ); } var maybeCallDoNotSellCallback = function() { if ( 'function' === typeof window.doNotSellCallback ) { return window.doNotSellCallback(); } return false; } // Look for usprivacy cookie first. var usprivacyCookie = cookieLib.getItem( 'usprivacy' ); // Found a usprivacy cookie. if ( null !== usprivacyCookie ) { // If the cookie indicates that CCPA does not apply, then bail. if ( '1---' === usprivacyCookie ) { return; } // CCPA applies, so call our callback to add Do Not Sell link to the page. maybeCallDoNotSellCallback(); // We're all done, no more processing needed. return; } // We don't have a usprivacy cookie, so check to see if we have a CCPA applies cookie. var ccpaCookie = cookieLib.getItem( 'ccpa_applies' ); // No CCPA applies cookie found, so we'll need to geolocate if this visitor is from California. // This needs to happen client side because we do not have region geo data in our \$SERVER headers, // only country data -- therefore we can't vary cache on the region. if ( null === ccpaCookie ) { var request = new XMLHttpRequest(); request.open( 'GET', 'https://public-api.wordpress.com/geo/', true ); request.onreadystatechange = function () { if ( 4 === this.readyState ) { if ( 200 === this.status ) { // Got a geo response. Parse out the region data. var data = JSON.parse( this.response ); var ccpa_applies = data['region'] && data['region'].toLowerCase() === 'california'; // Set CCPA applies cookie. This keeps us from having to make a geo request too frequently. setCcpaAppliesCookie( ccpa_applies ); // Check if CCPA applies to set the proper usprivacy cookie. if ( ccpa_applies ) { if ( maybeCallDoNotSellCallback() ) { // Do Not Sell link added, so set default opt-in. setDefaultOptInCookie(); } else { // Failed showing Do Not Sell link as required, so default to opt-OUT just to be safe. setDefaultOptOutCookie(); } } else { // CCPA does not apply. setDefaultNotApplicableCookie(); } } else { // Could not geo, so let's assume for now that CCPA applies to be safe. setCcpaAppliesCookie( true ); if ( maybeCallDoNotSellCallback() ) { // Do Not Sell link added, so set default opt-in. setDefaultOptInCookie(); } else { // Failed showing Do Not Sell link as required, so default to opt-OUT just to be safe. setDefaultOptOutCookie(); } } } }; // Send the geo request. request.send(); } else { // We found a CCPA applies cookie. if ( ccpaCookie === 'true' ) { if ( maybeCallDoNotSellCallback() ) { // Do Not Sell link added, so set default opt-in. setDefaultOptInCookie(); } else { // Failed showing Do Not Sell link as required, so default to opt-OUT just to be safe. setDefaultOptOutCookie(); } } else { // CCPA does not apply. setDefaultNotApplicableCookie(); } } } ); }; // Kickoff initialization. if ( window.defQueue && defQueue.isLOHP && defQueue.isLOHP === 2020 ) { defQueue.items.push( setupPrivacy ); } else { setupPrivacy(); } } )(); Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use. To find out more, including how to control cookies, see here: Cookie Policy ( function() { function init() { document.body.addEventListener( 'is.post-load', function() { if ( typeof __ATA.insertInlineAds === 'function' ) { __ATA.insertInlineAds(); } } ); } if ( document.readyState !== 'loading' ) { init(); } else { document.addEventListener( 'DOMContentLoaded', init ); } } )(); Follow Following Programming Praxis Join 821 other followers Already have a WordPress.com account? Log in now. Programming Praxis Customize Follow Following Sign up Log in Copy shortlink Report this content View post in Reader Manage subscriptions Collapse this bar window.addEventListener( "load", function( event ) { var link = document.createElement( "link" ); link.href = "https://s0.wp.com/wp-content/mu-plugins/actionbar/actionbar.css?v=20210915"; link.type = "text/css"; link.rel = "stylesheet"; document.head.appendChild( link ); var script = document.createElement( "script" ); script.src = "https://s0.wp.com/wp-content/mu-plugins/actionbar/actionbar.js?v=20220329"; script.defer = true; document.body.appendChild( script ); } ); window.WPCOM_sharing_counts = {"https:\/\/programmingpraxis.com\/2009\/11\/10\/merge-sort\/":1602}; (function(){ var corecss = document.createElement('link'); var themecss = document.createElement('link'); var corecssurl = "https://s1.wp.com/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/styles/shCore.css?ver=3.0.9b"; if ( corecss.setAttribute ) { corecss.setAttribute( "rel", "stylesheet" ); corecss.setAttribute( "type", "text/css" ); corecss.setAttribute( "href", corecssurl ); } else { corecss.rel = "stylesheet"; corecss.href = corecssurl; } document.head.appendChild( corecss ); var themecssurl = "https://s2.wp.com/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/styles/shThemeDefault.css?m=1363304414h&amp;ver=3.0.9b"; if ( themecss.setAttribute ) { themecss.setAttribute( "rel", "stylesheet" ); themecss.setAttribute( "type", "text/css" ); themecss.setAttribute( "href", themecssurl ); } else { themecss.rel = "stylesheet"; themecss.href = themecssurl; } document.head.appendChild( themecss ); })(); SyntaxHighlighter.config.strings.expandSource = '+ expand source'; SyntaxHighlighter.config.strings.help = '?'; SyntaxHighlighter.config.strings.alert = 'SyntaxHighlighter\n\n'; SyntaxHighlighter.config.strings.noBrush = 'Can\'t find brush for: '; SyntaxHighlighter.config.strings.brushNotHtmlScript = 'Brush wasn\'t configured for html-script option: '; SyntaxHighlighter.defaults['pad-line-numbers'] = false; SyntaxHighlighter.defaults['toolbar'] = false; SyntaxHighlighter.all(); // Infinite scroll support if ( typeof( jQuery ) !== 'undefined' ) { jQuery( function( \$ ) { \$( document.body ).on( 'post-load', function() { SyntaxHighlighter.highlight(); } ); } ); } var sharing_js_options = {"lang":"en","counts":"1","is_stats_active":"1"}; var windowOpen; ( function () { function matches( el, sel ) { return !! ( el.matches && el.matches( sel ) || el.msMatchesSelector && el.msMatchesSelector( sel ) ); } document.body.addEventListener( 'click', function ( event ) { if ( ! event.target ) { return; } var el; if ( matches( event.target, 'a.share-twitter' ) ) { el = event.target; } else if ( event.target.parentNode && matches( event.target.parentNode, 'a.share-twitter' ) ) { el = event.target.parentNode; } if ( el ) { event.preventDefault(); // If there's another sharing window open, close it. if ( typeof windowOpen !== 'undefined' ) { windowOpen.close(); } windowOpen = window.open( el.getAttribute( 'href' ), 'wpcomtwitter', 'menubar=1,resizable=1,width=600,height=350' ); return false; } } ); } )(); var windowOpen; ( function () { function matches( el, sel ) { return !! ( el.matches && el.matches( sel ) || el.msMatchesSelector && el.msMatchesSelector( sel ) ); } document.body.addEventListener( 'click', function ( event ) { if ( ! event.target ) { return; } var el; if ( matches( event.target, 'a.share-facebook' ) ) { el = event.target; } else if ( event.target.parentNode && matches( event.target.parentNode, 'a.share-facebook' ) ) { el = event.target.parentNode; } if ( el ) { event.preventDefault(); // If there's another sharing window open, close it. if ( typeof windowOpen !== 'undefined' ) { windowOpen.close(); } windowOpen = window.open( el.getAttribute( 'href' ), 'wpcomfacebook', 'menubar=1,resizable=1,width=600,height=400' ); return false; } } ); } )(); // <![CDATA[ (function() { try{ if ( window.external &&'msIsSiteMode' in window.external) { if (window.external.msIsSiteMode()) { var jl = document.createElement('script'); jl.type='text/javascript'; jl.async=true; jl.src='/wp-content/plugins/ie-sitemode/custom-jumplist.php'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(jl, s); } } }catch(e){} })(); // ]]> %d bloggers like this: _tkq = window._tkq || []; _stq = window._stq || []; _tkq.push(['storeContext', {'blog_id':'6649073','blog_tz':'0','user_lang':'en','blog_lang':'en','user_id':'0'}]); _stq.push(['view', {'blog':'6649073','v':'wpcom','tz':'0','user_id':'0','post':'1602','subd':'programmingpraxis'}]); _stq.push(['extra', {'crypt':'UE5XaGUuOTlwaD85flAmcm1mcmZsaDhkV11YdWtpP0NsWnVkPS9sL0ViLndld3BuVT01Unp2dX5PUGg5S0U1NzhRY2ItWDJQVGMmRG1jT2ZiWWc1ZUo1LCt4LTVdaFhJc0xofEFOX2UxbEV8WjZJQW1VWmt2Jms9TGtvX2RkUDJTdCZPY2hTUDFKVDZhLT9RMWtpQzRBbDYvP1dzQktVaU1pb35CR1ZnUDJjN3RjUkw9VXNKVFBaPTd6Yl1bTmZvQnlNdCs1KzFDZTM0TU1qdVJTbURYflQlOGZXXyZtWE1uMytbdl04ekloT09VT1NfZ19SJi1qNjl5cWFfMWRxLmc0WVFTeElfRl9dcT1qVmt8bEFLSGRHVzM1d3daP2JoVGNqeSVfejQ='}]); _stq.push([ 'clickTrackerInit', '6649073', '1602' ]); if ( 'object' === typeof wpcom_mobile_user_agent_info ) { wpcom_mobile_user_agent_info.init(); var mobileStatsQueryString = ""; if( false !== wpcom_mobile_user_agent_info.matchedPlatformName ) mobileStatsQueryString += "&x_" + 'mobile_platforms' + '=' + wpcom_mobile_user_agent_info.matchedPlatformName; if( false !== wpcom_mobile_user_agent_info.matchedUserAgentName ) mobileStatsQueryString += "&x_" + 'mobile_devices' + '=' + wpcom_mobile_user_agent_info.matchedUserAgentName; if( wpcom_mobile_user_agent_info.isIPad() ) mobileStatsQueryString += "&x_" + 'ipad_views' + '=' + 'views'; if( "" != mobileStatsQueryString ) { new Image().src = document.location.protocol + '//pixel.wp.com/g.gif?v=wpcom-no-pv' + mobileStatsQueryString + '&baba=' + Math.random(); } } ```