Median of three partitioning taking more time than standard quicksort in javaThree way Quicksort in JavaQuickMergeSort — The power of internal bufferingQuickSort Median of Three V2Median of 3 partitioning taking more time than quicksort in java
What does "I’d sit this one out, Cap," imply or mean in the context?
How to pronounce the slash sign
How easy is it to start Magic from scratch?
Increase performance creating Mandelbrot set in python
Overloading istream>> to read comma-separated input
Short story about space worker geeks who zone out by 'listening' to radiation from stars
What's the purpose of "true" in bash "if sudo true; then"
Customer Requests (Sometimes) Drive Me Bonkers!
What Brexit proposals are on the table in the indicative votes on the 27th of March 2019?
Is it okay for two “sein” to be next to each other?
How do scammers retract money, while you can’t?
Valid Badminton Score?
Why Were Madagascar and New Zealand Discovered So Late?
How do I rename a Linux host without needing to reboot for the rename to take effect?
Personal Teleportation as a Weapon
How to safely derail a train during transit?
Is exact Kanji stroke length important?
How to draw lines on a tikz-cd diagram
Balance Issues for a Custom Sorcerer Variant
India just shot down a satellite from the ground. At what altitude range is the resulting debris field?
Applicability of Single Responsibility Principle
Why escape if the_content isnt?
How can a function with a hole (removable discontinuity) equal a function with no hole?
How to check is there any negative term in a large list?
Median of three partitioning taking more time than standard quicksort in java
Three way Quicksort in JavaQuickMergeSort — The power of internal bufferingQuickSort Median of Three V2Median of 3 partitioning taking more time than quicksort in java
$begingroup$
I implemented a standard quicksort and I have a project where I need to improve it. I am trying to make quicksort faster by implementing median of 3 partitioning. I copied codes from trusted educational sites and the code is working, everything is being sorted. The issue is that, the median of 3 partitioning is taking 20 milliseconds to 40 milliseconds more than the standard quicksort. I am sorting 10240000 integers, positive and negative. can anybody help me solve this out?
main class
package sorttest;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
public class SortTest
public static void main(String[] args) throws FileNotFoundException, IOException
Clock c = new Clock();
int lo = 0;
int hi = 10239999;
sort s = new sort();
Option2 o = new Option2();
int[] NumArray = populate();
/*c.start();
s.quick(NumArray, lo, hi);
double time = c.stop();
System.out.println("Improved quicksort takes " +time);*/
int[] NumArrays = populate();
c.start();
s.quickiSort(NumArrays, lo, hi);
double times = c.stop();
System.out.println("Quicksort takes " + times);
c.start();
o.quickSort(NumArray, lo, hi);
double time = c.stop();
System.out.println("Improved quicksort takes " + time);
/*for (int i =0; i<NumArray.length; i++)
System.out.println(NumArray[i]);
*/
public static int[] populate() throws FileNotFoundException, IOException
String[] splitArr = split();
int[] arr = new int[10240000];
for (int i = 0; i < splitArr.length; i++)
int num = Integer.parseInt(splitArr[i]);
arr[i] = num;
return arr;
public static String[] split() throws FileNotFoundException, IOException
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("C:\Users\username\Documents\year2\Engeneering Software Development\cw3\ints10240000.dat")));
String line;
String[] aList = new String[10240000];
while ((line = reader.readLine()) != null)
aList = line.split("\s+");
//String aList = (line.split("\s+"))); //using whitespace as delimeter to split
return aList;
Standard quicksort
public void quickiSort(int arr[], int begin, int end)
if (begin < end)
int partitionIndex = partitionL(arr, begin, end);
quickiSort(arr, begin, partitionIndex - 1);
quickiSort(arr, partitionIndex + 1, end);
private int partitionL(int arr[], int begin, int end)
int pivot = arr[end];
int i = (begin - 1);
for (int j = begin; j < end; j++)
if (arr[j] <= pivot)
i++;
int swapTemp = arr[i];
arr[i] = arr[j];
arr[j] = swapTemp;
int swapTemp = arr[i + 1];
arr[i + 1] = arr[end];
arr[end] = swapTemp;
return i + 1;
Median of 3 quicksort
package sorttest;
public class Option2
public void quickSort(int[] theArray, int lo, int hi)
recQuickSort(theArray, lo, hi);
public void recQuickSort(int[] theArray, int left, int right)
int size = right - left + 1;
if (size <= 3)
manualSort(theArray, left, right);
else
long median = medianOf3(theArray, left, right);
int partition = partitionIt(theArray, left, right, median);
recQuickSort(theArray, left, partition - 1);
recQuickSort(theArray, partition + 1, right);
public long medianOf3(int[] theArray, int left, int right)
int center = (left + right) / 2;
if (theArray[left] > theArray[center])
swap(left, center, theArray);
if (theArray[left] > theArray[right])
swap(left, right, theArray);
if (theArray[center] > theArray[right])
swap(center, right, theArray);
swap(center, right - 1, theArray);
return theArray[right - 1];
public void swap(int dex1, int dex2, int[] theArray)
int temp = theArray[dex1];
theArray[dex1] = theArray[dex2];
theArray[dex2] = temp;
public int partitionIt(int[] theArray, int left, int right, long pivot)
int leftPtr = left;
int rightPtr = right - 1;
while (true)
while (theArray[++leftPtr] < pivot)
;
while (theArray[--rightPtr] > pivot)
;
if (leftPtr >= rightPtr)
break;
else
swap(leftPtr, rightPtr, theArray);
swap(leftPtr, right - 1, theArray);
return leftPtr;
public void manualSort(int[] theArray, int left, int right)
int size = right - left + 1;
if (size <= 1)
return;
if (size == 2)
if (theArray[left] > theArray[right])
swap(left, right, theArray);
return;
else
if (theArray[left] > theArray[right - 1])
swap(left, right - 1, theArray);
if (theArray[left] > theArray[right])
swap(left, right, theArray);
if (theArray[right - 1] > theArray[right])
swap(right - 1, right, theArray);
java sorting comparative-review quick-sort
New contributor
teddy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
add a comment |
$begingroup$
I implemented a standard quicksort and I have a project where I need to improve it. I am trying to make quicksort faster by implementing median of 3 partitioning. I copied codes from trusted educational sites and the code is working, everything is being sorted. The issue is that, the median of 3 partitioning is taking 20 milliseconds to 40 milliseconds more than the standard quicksort. I am sorting 10240000 integers, positive and negative. can anybody help me solve this out?
main class
package sorttest;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
public class SortTest
public static void main(String[] args) throws FileNotFoundException, IOException
Clock c = new Clock();
int lo = 0;
int hi = 10239999;
sort s = new sort();
Option2 o = new Option2();
int[] NumArray = populate();
/*c.start();
s.quick(NumArray, lo, hi);
double time = c.stop();
System.out.println("Improved quicksort takes " +time);*/
int[] NumArrays = populate();
c.start();
s.quickiSort(NumArrays, lo, hi);
double times = c.stop();
System.out.println("Quicksort takes " + times);
c.start();
o.quickSort(NumArray, lo, hi);
double time = c.stop();
System.out.println("Improved quicksort takes " + time);
/*for (int i =0; i<NumArray.length; i++)
System.out.println(NumArray[i]);
*/
public static int[] populate() throws FileNotFoundException, IOException
String[] splitArr = split();
int[] arr = new int[10240000];
for (int i = 0; i < splitArr.length; i++)
int num = Integer.parseInt(splitArr[i]);
arr[i] = num;
return arr;
public static String[] split() throws FileNotFoundException, IOException
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("C:\Users\username\Documents\year2\Engeneering Software Development\cw3\ints10240000.dat")));
String line;
String[] aList = new String[10240000];
while ((line = reader.readLine()) != null)
aList = line.split("\s+");
//String aList = (line.split("\s+"))); //using whitespace as delimeter to split
return aList;
Standard quicksort
public void quickiSort(int arr[], int begin, int end)
if (begin < end)
int partitionIndex = partitionL(arr, begin, end);
quickiSort(arr, begin, partitionIndex - 1);
quickiSort(arr, partitionIndex + 1, end);
private int partitionL(int arr[], int begin, int end)
int pivot = arr[end];
int i = (begin - 1);
for (int j = begin; j < end; j++)
if (arr[j] <= pivot)
i++;
int swapTemp = arr[i];
arr[i] = arr[j];
arr[j] = swapTemp;
int swapTemp = arr[i + 1];
arr[i + 1] = arr[end];
arr[end] = swapTemp;
return i + 1;
Median of 3 quicksort
package sorttest;
public class Option2
public void quickSort(int[] theArray, int lo, int hi)
recQuickSort(theArray, lo, hi);
public void recQuickSort(int[] theArray, int left, int right)
int size = right - left + 1;
if (size <= 3)
manualSort(theArray, left, right);
else
long median = medianOf3(theArray, left, right);
int partition = partitionIt(theArray, left, right, median);
recQuickSort(theArray, left, partition - 1);
recQuickSort(theArray, partition + 1, right);
public long medianOf3(int[] theArray, int left, int right)
int center = (left + right) / 2;
if (theArray[left] > theArray[center])
swap(left, center, theArray);
if (theArray[left] > theArray[right])
swap(left, right, theArray);
if (theArray[center] > theArray[right])
swap(center, right, theArray);
swap(center, right - 1, theArray);
return theArray[right - 1];
public void swap(int dex1, int dex2, int[] theArray)
int temp = theArray[dex1];
theArray[dex1] = theArray[dex2];
theArray[dex2] = temp;
public int partitionIt(int[] theArray, int left, int right, long pivot)
int leftPtr = left;
int rightPtr = right - 1;
while (true)
while (theArray[++leftPtr] < pivot)
;
while (theArray[--rightPtr] > pivot)
;
if (leftPtr >= rightPtr)
break;
else
swap(leftPtr, rightPtr, theArray);
swap(leftPtr, right - 1, theArray);
return leftPtr;
public void manualSort(int[] theArray, int left, int right)
int size = right - left + 1;
if (size <= 1)
return;
if (size == 2)
if (theArray[left] > theArray[right])
swap(left, right, theArray);
return;
else
if (theArray[left] > theArray[right - 1])
swap(left, right - 1, theArray);
if (theArray[left] > theArray[right])
swap(left, right, theArray);
if (theArray[right - 1] > theArray[right])
swap(right - 1, right, theArray);
java sorting comparative-review quick-sort
New contributor
teddy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
add a comment |
$begingroup$
I implemented a standard quicksort and I have a project where I need to improve it. I am trying to make quicksort faster by implementing median of 3 partitioning. I copied codes from trusted educational sites and the code is working, everything is being sorted. The issue is that, the median of 3 partitioning is taking 20 milliseconds to 40 milliseconds more than the standard quicksort. I am sorting 10240000 integers, positive and negative. can anybody help me solve this out?
main class
package sorttest;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
public class SortTest
public static void main(String[] args) throws FileNotFoundException, IOException
Clock c = new Clock();
int lo = 0;
int hi = 10239999;
sort s = new sort();
Option2 o = new Option2();
int[] NumArray = populate();
/*c.start();
s.quick(NumArray, lo, hi);
double time = c.stop();
System.out.println("Improved quicksort takes " +time);*/
int[] NumArrays = populate();
c.start();
s.quickiSort(NumArrays, lo, hi);
double times = c.stop();
System.out.println("Quicksort takes " + times);
c.start();
o.quickSort(NumArray, lo, hi);
double time = c.stop();
System.out.println("Improved quicksort takes " + time);
/*for (int i =0; i<NumArray.length; i++)
System.out.println(NumArray[i]);
*/
public static int[] populate() throws FileNotFoundException, IOException
String[] splitArr = split();
int[] arr = new int[10240000];
for (int i = 0; i < splitArr.length; i++)
int num = Integer.parseInt(splitArr[i]);
arr[i] = num;
return arr;
public static String[] split() throws FileNotFoundException, IOException
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("C:\Users\username\Documents\year2\Engeneering Software Development\cw3\ints10240000.dat")));
String line;
String[] aList = new String[10240000];
while ((line = reader.readLine()) != null)
aList = line.split("\s+");
//String aList = (line.split("\s+"))); //using whitespace as delimeter to split
return aList;
Standard quicksort
public void quickiSort(int arr[], int begin, int end)
if (begin < end)
int partitionIndex = partitionL(arr, begin, end);
quickiSort(arr, begin, partitionIndex - 1);
quickiSort(arr, partitionIndex + 1, end);
private int partitionL(int arr[], int begin, int end)
int pivot = arr[end];
int i = (begin - 1);
for (int j = begin; j < end; j++)
if (arr[j] <= pivot)
i++;
int swapTemp = arr[i];
arr[i] = arr[j];
arr[j] = swapTemp;
int swapTemp = arr[i + 1];
arr[i + 1] = arr[end];
arr[end] = swapTemp;
return i + 1;
Median of 3 quicksort
package sorttest;
public class Option2
public void quickSort(int[] theArray, int lo, int hi)
recQuickSort(theArray, lo, hi);
public void recQuickSort(int[] theArray, int left, int right)
int size = right - left + 1;
if (size <= 3)
manualSort(theArray, left, right);
else
long median = medianOf3(theArray, left, right);
int partition = partitionIt(theArray, left, right, median);
recQuickSort(theArray, left, partition - 1);
recQuickSort(theArray, partition + 1, right);
public long medianOf3(int[] theArray, int left, int right)
int center = (left + right) / 2;
if (theArray[left] > theArray[center])
swap(left, center, theArray);
if (theArray[left] > theArray[right])
swap(left, right, theArray);
if (theArray[center] > theArray[right])
swap(center, right, theArray);
swap(center, right - 1, theArray);
return theArray[right - 1];
public void swap(int dex1, int dex2, int[] theArray)
int temp = theArray[dex1];
theArray[dex1] = theArray[dex2];
theArray[dex2] = temp;
public int partitionIt(int[] theArray, int left, int right, long pivot)
int leftPtr = left;
int rightPtr = right - 1;
while (true)
while (theArray[++leftPtr] < pivot)
;
while (theArray[--rightPtr] > pivot)
;
if (leftPtr >= rightPtr)
break;
else
swap(leftPtr, rightPtr, theArray);
swap(leftPtr, right - 1, theArray);
return leftPtr;
public void manualSort(int[] theArray, int left, int right)
int size = right - left + 1;
if (size <= 1)
return;
if (size == 2)
if (theArray[left] > theArray[right])
swap(left, right, theArray);
return;
else
if (theArray[left] > theArray[right - 1])
swap(left, right - 1, theArray);
if (theArray[left] > theArray[right])
swap(left, right, theArray);
if (theArray[right - 1] > theArray[right])
swap(right - 1, right, theArray);
java sorting comparative-review quick-sort
New contributor
teddy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
I implemented a standard quicksort and I have a project where I need to improve it. I am trying to make quicksort faster by implementing median of 3 partitioning. I copied codes from trusted educational sites and the code is working, everything is being sorted. The issue is that, the median of 3 partitioning is taking 20 milliseconds to 40 milliseconds more than the standard quicksort. I am sorting 10240000 integers, positive and negative. can anybody help me solve this out?
main class
package sorttest;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
public class SortTest
public static void main(String[] args) throws FileNotFoundException, IOException
Clock c = new Clock();
int lo = 0;
int hi = 10239999;
sort s = new sort();
Option2 o = new Option2();
int[] NumArray = populate();
/*c.start();
s.quick(NumArray, lo, hi);
double time = c.stop();
System.out.println("Improved quicksort takes " +time);*/
int[] NumArrays = populate();
c.start();
s.quickiSort(NumArrays, lo, hi);
double times = c.stop();
System.out.println("Quicksort takes " + times);
c.start();
o.quickSort(NumArray, lo, hi);
double time = c.stop();
System.out.println("Improved quicksort takes " + time);
/*for (int i =0; i<NumArray.length; i++)
System.out.println(NumArray[i]);
*/
public static int[] populate() throws FileNotFoundException, IOException
String[] splitArr = split();
int[] arr = new int[10240000];
for (int i = 0; i < splitArr.length; i++)
int num = Integer.parseInt(splitArr[i]);
arr[i] = num;
return arr;
public static String[] split() throws FileNotFoundException, IOException
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("C:\Users\username\Documents\year2\Engeneering Software Development\cw3\ints10240000.dat")));
String line;
String[] aList = new String[10240000];
while ((line = reader.readLine()) != null)
aList = line.split("\s+");
//String aList = (line.split("\s+"))); //using whitespace as delimeter to split
return aList;
Standard quicksort
public void quickiSort(int arr[], int begin, int end)
if (begin < end)
int partitionIndex = partitionL(arr, begin, end);
quickiSort(arr, begin, partitionIndex - 1);
quickiSort(arr, partitionIndex + 1, end);
private int partitionL(int arr[], int begin, int end)
int pivot = arr[end];
int i = (begin - 1);
for (int j = begin; j < end; j++)
if (arr[j] <= pivot)
i++;
int swapTemp = arr[i];
arr[i] = arr[j];
arr[j] = swapTemp;
int swapTemp = arr[i + 1];
arr[i + 1] = arr[end];
arr[end] = swapTemp;
return i + 1;
Median of 3 quicksort
package sorttest;
public class Option2
public void quickSort(int[] theArray, int lo, int hi)
recQuickSort(theArray, lo, hi);
public void recQuickSort(int[] theArray, int left, int right)
int size = right - left + 1;
if (size <= 3)
manualSort(theArray, left, right);
else
long median = medianOf3(theArray, left, right);
int partition = partitionIt(theArray, left, right, median);
recQuickSort(theArray, left, partition - 1);
recQuickSort(theArray, partition + 1, right);
public long medianOf3(int[] theArray, int left, int right)
int center = (left + right) / 2;
if (theArray[left] > theArray[center])
swap(left, center, theArray);
if (theArray[left] > theArray[right])
swap(left, right, theArray);
if (theArray[center] > theArray[right])
swap(center, right, theArray);
swap(center, right - 1, theArray);
return theArray[right - 1];
public void swap(int dex1, int dex2, int[] theArray)
int temp = theArray[dex1];
theArray[dex1] = theArray[dex2];
theArray[dex2] = temp;
public int partitionIt(int[] theArray, int left, int right, long pivot)
int leftPtr = left;
int rightPtr = right - 1;
while (true)
while (theArray[++leftPtr] < pivot)
;
while (theArray[--rightPtr] > pivot)
;
if (leftPtr >= rightPtr)
break;
else
swap(leftPtr, rightPtr, theArray);
swap(leftPtr, right - 1, theArray);
return leftPtr;
public void manualSort(int[] theArray, int left, int right)
int size = right - left + 1;
if (size <= 1)
return;
if (size == 2)
if (theArray[left] > theArray[right])
swap(left, right, theArray);
return;
else
if (theArray[left] > theArray[right - 1])
swap(left, right - 1, theArray);
if (theArray[left] > theArray[right])
swap(left, right, theArray);
if (theArray[right - 1] > theArray[right])
swap(right - 1, right, theArray);
java sorting comparative-review quick-sort
java sorting comparative-review quick-sort
New contributor
teddy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
teddy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
teddy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 4 mins ago
teddyteddy
61
61
New contributor
teddy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
teddy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
teddy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
);
);
, "mathjax-editing");
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "196"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
teddy is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f216374%2fmedian-of-three-partitioning-taking-more-time-than-standard-quicksort-in-java%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
teddy is a new contributor. Be nice, and check out our Code of Conduct.
teddy is a new contributor. Be nice, and check out our Code of Conduct.
teddy is a new contributor. Be nice, and check out our Code of Conduct.
teddy is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Code Review Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f216374%2fmedian-of-three-partitioning-taking-more-time-than-standard-quicksort-in-java%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown