Median Algorithm for 4 sorted arraysFind median in four (individually) sorted arrays with O(1) spaceSort a Map<Key, Value> by valuesCreate ArrayList from arrayHow do I check if an array includes an object in JavaScript?What is the best algorithm for an overridden System.Object.GetHashCode?How do I create a URL shortener?Fastest sort of fixed length 6 int arrayEasy interview question got harder: given numbers 1..100, find the missing number(s)Image Processing: Algorithm Improvement for 'Coca-Cola Can' RecognitionWhy is it faster to process a sorted array than an unsorted array?What is the optimal algorithm for the game 2048?
Why was the small council so happy for Tyrion to become the Master of Coin?
Is it unprofessional to ask if a job posting on GlassDoor is real?
Is it possible to do 50 km distance without any previous training?
Why not use SQL instead of GraphQL?
How much RAM could one put in a typical 80386 setup?
How is the claim "I am in New York only if I am in America" the same as "If I am in New York, then I am in America?
What defenses are there against being summoned by the Gate spell?
Languages that we cannot (dis)prove to be Context-Free
Problem of parity - Can we draw a closed path made up of 20 line segments...
"You are your self first supporter", a more proper way to say it
Why do falling prices hurt debtors?
Can I ask the recruiters in my resume to put the reason why I am rejected?
Is it tax fraud for an individual to declare non-taxable revenue as taxable income? (US tax laws)
What would happen to a modern skyscraper if it rains micro blackholes?
Fencing style for blades that can attack from a distance
What is the offset in a seaplane's hull?
How can I make my BBEG immortal short of making them a Lich or Vampire?
How to find program name(s) of an installed package?
Why dont electromagnetic waves interact with each other?
What are these boxed doors outside store fronts in New York?
Has the BBC provided arguments for saying Brexit being cancelled is unlikely?
How is it possible to have an ability score that is less than 3?
Today is the Center
What is the word for reserving something for yourself before others do?
Median Algorithm for 4 sorted arrays
Find median in four (individually) sorted arrays with O(1) spaceSort a Map<Key, Value> by valuesCreate ArrayList from arrayHow do I check if an array includes an object in JavaScript?What is the best algorithm for an overridden System.Object.GetHashCode?How do I create a URL shortener?Fastest sort of fixed length 6 int arrayEasy interview question got harder: given numbers 1..100, find the missing number(s)Image Processing: Algorithm Improvement for 'Coca-Cola Can' RecognitionWhy is it faster to process a sorted array than an unsorted array?What is the optimal algorithm for the game 2048?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I need to write an Algorithm for my course, to find the middle value of 4 sorted arrays different sizes in O(n), and i'm not allowed to create an array to store the data.
how should I approach the problem? I thought about running on a loop with 4 indexes as if i'm sorting the arrays into a big array but instead just run without storing the data. the loop will stop at n/2 and it should provide me the middle value.
writing it seems complex and very messy (i need to check for 4 of the arrays if i'm out of bound), is there a better way to approach this?
java algorithm median
add a comment |
I need to write an Algorithm for my course, to find the middle value of 4 sorted arrays different sizes in O(n), and i'm not allowed to create an array to store the data.
how should I approach the problem? I thought about running on a loop with 4 indexes as if i'm sorting the arrays into a big array but instead just run without storing the data. the loop will stop at n/2 and it should provide me the middle value.
writing it seems complex and very messy (i need to check for 4 of the arrays if i'm out of bound), is there a better way to approach this?
java algorithm median
3
Possible duplicate of Find median in four (individually) sorted arrays with O(1) space
– Matt Timmermans
Mar 21 at 23:38
The question linked dropped the explicit mention ofdifferent sizes
. It has no useful answer as of this comment.
– greybeard
Mar 22 at 6:52
add a comment |
I need to write an Algorithm for my course, to find the middle value of 4 sorted arrays different sizes in O(n), and i'm not allowed to create an array to store the data.
how should I approach the problem? I thought about running on a loop with 4 indexes as if i'm sorting the arrays into a big array but instead just run without storing the data. the loop will stop at n/2 and it should provide me the middle value.
writing it seems complex and very messy (i need to check for 4 of the arrays if i'm out of bound), is there a better way to approach this?
java algorithm median
I need to write an Algorithm for my course, to find the middle value of 4 sorted arrays different sizes in O(n), and i'm not allowed to create an array to store the data.
how should I approach the problem? I thought about running on a loop with 4 indexes as if i'm sorting the arrays into a big array but instead just run without storing the data. the loop will stop at n/2 and it should provide me the middle value.
writing it seems complex and very messy (i need to check for 4 of the arrays if i'm out of bound), is there a better way to approach this?
java algorithm median
java algorithm median
asked Mar 21 at 22:58
Arik ShapiroArik Shapiro
1
1
3
Possible duplicate of Find median in four (individually) sorted arrays with O(1) space
– Matt Timmermans
Mar 21 at 23:38
The question linked dropped the explicit mention ofdifferent sizes
. It has no useful answer as of this comment.
– greybeard
Mar 22 at 6:52
add a comment |
3
Possible duplicate of Find median in four (individually) sorted arrays with O(1) space
– Matt Timmermans
Mar 21 at 23:38
The question linked dropped the explicit mention ofdifferent sizes
. It has no useful answer as of this comment.
– greybeard
Mar 22 at 6:52
3
3
Possible duplicate of Find median in four (individually) sorted arrays with O(1) space
– Matt Timmermans
Mar 21 at 23:38
Possible duplicate of Find median in four (individually) sorted arrays with O(1) space
– Matt Timmermans
Mar 21 at 23:38
The question linked dropped the explicit mention of
different sizes
. It has no useful answer as of this comment.– greybeard
Mar 22 at 6:52
The question linked dropped the explicit mention of
different sizes
. It has no useful answer as of this comment.– greybeard
Mar 22 at 6:52
add a comment |
2 Answers
2
active
oldest
votes
I think you're on to the key idea: the median value of all the values in four arrays is just the median of all the values, so if we get half way through all the values then whatever is next is the median. I would suggest structuring as follows:
int firstIndex = 0;
int secondIndex = 0;
int thirdIndex = 0;
int fourthIndex = 0;
double current;
for (int i = 0; i < n/2; i++)
// 1.) Find the value out of the four at firstIndex, secondIndex, ...
// which is smallest, and assign it to current
// 2.) Increment whichever of the four indices belongs to that element
// whatever is in current at the end of the loop is the middle element
You probably want a function findMin(int index1, int index2, int index3, int index4)
. This method could also be responsible for the out-of-bounds checks, so the main loop could just rely on it to be pointed in the right direction, and not care if it's run out of elements in any given array.
Does this make sense? I've tried to leave enough ambiguity to let you handle most of the real implementation work :)
I already had this much figured out.. the problem is findMin cannot be responsible for out-of-bounds checks because you'd need to be giving it the arrays too or atleast at array's length. the second problem is if you make a findMin function once you find the min value and send it back how will you know which index gave you that number. you'd need a global index but that's prohibited.
– Arik Shapiro
Mar 22 at 10:26
“You’d need to be giving it the arrays too” yes, or make the arrays part of state whichfindMin()
can access (i.e. global variables). “How will you know which index gave you that number” since you’re keeping track offirstIndex
,secondIndex
, etc, why shouldfindMin()
return the min value at all?
– MyStackRunnethOver
Mar 23 at 3:34
add a comment |
Think of a single unsorted array
Consider thinking about the 4 arrays as a single unsorted array, broken into 4 parts. If you can modify the arrays, you can sort all 4 arrays as if 1 by swapping values between them (some optimizations can be made since you know the 4 arrays are sorted). Once you've sorted the arrays up to n/2 (where n is the aggregate length of the 4 arrays), just return the middle value of all 4.
Some Code
The implementation below begins to make multiple arrays function like a single one. I've implemented get
, set
, and length
methods, the basis for any array. All that needs to happen now is for the class' data to be sorted (possibly up to n/2) using get(int)
, set(int,int)
, and length()
, and a method which returns the median value median()
.
There is also room for further optimization by sorting only up to n/2 within the median method, also when caching (i,j) pairs for each element when doing so.
int median( int[] a1, int[] a2, int[] a3, int[] a4 )
MultiIntArray array = new MultiIntArray( a1, a2, a3, a4 );
array.sort();
return array.get( array.length() / 2 );
public class MultiIntArray
private int[][] data;
public MultiIntArray( int[]... data )
this.data = data;
public void sort()
// FOR YOU TO IMPLEMENT
public int length()
int length = 0;
for ( int[] array : data )
length += array.length;
return length;
public int get( int index )
int i = 0;
while ( index >= data[i].length )
index -= data[i].length;
i += 1;
return data[i][index];
public void set( int index, int value )
int i = 0;
while ( index >= data[i].length )
index -= data[i].length;
i += 1;
data[i][index] = value;
add a comment |
Your Answer
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: "1"
;
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
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%2fstackoverflow.com%2fquestions%2f55290460%2fmedian-algorithm-for-4-sorted-arrays%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I think you're on to the key idea: the median value of all the values in four arrays is just the median of all the values, so if we get half way through all the values then whatever is next is the median. I would suggest structuring as follows:
int firstIndex = 0;
int secondIndex = 0;
int thirdIndex = 0;
int fourthIndex = 0;
double current;
for (int i = 0; i < n/2; i++)
// 1.) Find the value out of the four at firstIndex, secondIndex, ...
// which is smallest, and assign it to current
// 2.) Increment whichever of the four indices belongs to that element
// whatever is in current at the end of the loop is the middle element
You probably want a function findMin(int index1, int index2, int index3, int index4)
. This method could also be responsible for the out-of-bounds checks, so the main loop could just rely on it to be pointed in the right direction, and not care if it's run out of elements in any given array.
Does this make sense? I've tried to leave enough ambiguity to let you handle most of the real implementation work :)
I already had this much figured out.. the problem is findMin cannot be responsible for out-of-bounds checks because you'd need to be giving it the arrays too or atleast at array's length. the second problem is if you make a findMin function once you find the min value and send it back how will you know which index gave you that number. you'd need a global index but that's prohibited.
– Arik Shapiro
Mar 22 at 10:26
“You’d need to be giving it the arrays too” yes, or make the arrays part of state whichfindMin()
can access (i.e. global variables). “How will you know which index gave you that number” since you’re keeping track offirstIndex
,secondIndex
, etc, why shouldfindMin()
return the min value at all?
– MyStackRunnethOver
Mar 23 at 3:34
add a comment |
I think you're on to the key idea: the median value of all the values in four arrays is just the median of all the values, so if we get half way through all the values then whatever is next is the median. I would suggest structuring as follows:
int firstIndex = 0;
int secondIndex = 0;
int thirdIndex = 0;
int fourthIndex = 0;
double current;
for (int i = 0; i < n/2; i++)
// 1.) Find the value out of the four at firstIndex, secondIndex, ...
// which is smallest, and assign it to current
// 2.) Increment whichever of the four indices belongs to that element
// whatever is in current at the end of the loop is the middle element
You probably want a function findMin(int index1, int index2, int index3, int index4)
. This method could also be responsible for the out-of-bounds checks, so the main loop could just rely on it to be pointed in the right direction, and not care if it's run out of elements in any given array.
Does this make sense? I've tried to leave enough ambiguity to let you handle most of the real implementation work :)
I already had this much figured out.. the problem is findMin cannot be responsible for out-of-bounds checks because you'd need to be giving it the arrays too or atleast at array's length. the second problem is if you make a findMin function once you find the min value and send it back how will you know which index gave you that number. you'd need a global index but that's prohibited.
– Arik Shapiro
Mar 22 at 10:26
“You’d need to be giving it the arrays too” yes, or make the arrays part of state whichfindMin()
can access (i.e. global variables). “How will you know which index gave you that number” since you’re keeping track offirstIndex
,secondIndex
, etc, why shouldfindMin()
return the min value at all?
– MyStackRunnethOver
Mar 23 at 3:34
add a comment |
I think you're on to the key idea: the median value of all the values in four arrays is just the median of all the values, so if we get half way through all the values then whatever is next is the median. I would suggest structuring as follows:
int firstIndex = 0;
int secondIndex = 0;
int thirdIndex = 0;
int fourthIndex = 0;
double current;
for (int i = 0; i < n/2; i++)
// 1.) Find the value out of the four at firstIndex, secondIndex, ...
// which is smallest, and assign it to current
// 2.) Increment whichever of the four indices belongs to that element
// whatever is in current at the end of the loop is the middle element
You probably want a function findMin(int index1, int index2, int index3, int index4)
. This method could also be responsible for the out-of-bounds checks, so the main loop could just rely on it to be pointed in the right direction, and not care if it's run out of elements in any given array.
Does this make sense? I've tried to leave enough ambiguity to let you handle most of the real implementation work :)
I think you're on to the key idea: the median value of all the values in four arrays is just the median of all the values, so if we get half way through all the values then whatever is next is the median. I would suggest structuring as follows:
int firstIndex = 0;
int secondIndex = 0;
int thirdIndex = 0;
int fourthIndex = 0;
double current;
for (int i = 0; i < n/2; i++)
// 1.) Find the value out of the four at firstIndex, secondIndex, ...
// which is smallest, and assign it to current
// 2.) Increment whichever of the four indices belongs to that element
// whatever is in current at the end of the loop is the middle element
You probably want a function findMin(int index1, int index2, int index3, int index4)
. This method could also be responsible for the out-of-bounds checks, so the main loop could just rely on it to be pointed in the right direction, and not care if it's run out of elements in any given array.
Does this make sense? I've tried to leave enough ambiguity to let you handle most of the real implementation work :)
answered Mar 21 at 23:40
MyStackRunnethOverMyStackRunnethOver
1,011819
1,011819
I already had this much figured out.. the problem is findMin cannot be responsible for out-of-bounds checks because you'd need to be giving it the arrays too or atleast at array's length. the second problem is if you make a findMin function once you find the min value and send it back how will you know which index gave you that number. you'd need a global index but that's prohibited.
– Arik Shapiro
Mar 22 at 10:26
“You’d need to be giving it the arrays too” yes, or make the arrays part of state whichfindMin()
can access (i.e. global variables). “How will you know which index gave you that number” since you’re keeping track offirstIndex
,secondIndex
, etc, why shouldfindMin()
return the min value at all?
– MyStackRunnethOver
Mar 23 at 3:34
add a comment |
I already had this much figured out.. the problem is findMin cannot be responsible for out-of-bounds checks because you'd need to be giving it the arrays too or atleast at array's length. the second problem is if you make a findMin function once you find the min value and send it back how will you know which index gave you that number. you'd need a global index but that's prohibited.
– Arik Shapiro
Mar 22 at 10:26
“You’d need to be giving it the arrays too” yes, or make the arrays part of state whichfindMin()
can access (i.e. global variables). “How will you know which index gave you that number” since you’re keeping track offirstIndex
,secondIndex
, etc, why shouldfindMin()
return the min value at all?
– MyStackRunnethOver
Mar 23 at 3:34
I already had this much figured out.. the problem is findMin cannot be responsible for out-of-bounds checks because you'd need to be giving it the arrays too or atleast at array's length. the second problem is if you make a findMin function once you find the min value and send it back how will you know which index gave you that number. you'd need a global index but that's prohibited.
– Arik Shapiro
Mar 22 at 10:26
I already had this much figured out.. the problem is findMin cannot be responsible for out-of-bounds checks because you'd need to be giving it the arrays too or atleast at array's length. the second problem is if you make a findMin function once you find the min value and send it back how will you know which index gave you that number. you'd need a global index but that's prohibited.
– Arik Shapiro
Mar 22 at 10:26
“You’d need to be giving it the arrays too” yes, or make the arrays part of state which
findMin()
can access (i.e. global variables). “How will you know which index gave you that number” since you’re keeping track of firstIndex
, secondIndex
, etc, why should findMin()
return the min value at all?– MyStackRunnethOver
Mar 23 at 3:34
“You’d need to be giving it the arrays too” yes, or make the arrays part of state which
findMin()
can access (i.e. global variables). “How will you know which index gave you that number” since you’re keeping track of firstIndex
, secondIndex
, etc, why should findMin()
return the min value at all?– MyStackRunnethOver
Mar 23 at 3:34
add a comment |
Think of a single unsorted array
Consider thinking about the 4 arrays as a single unsorted array, broken into 4 parts. If you can modify the arrays, you can sort all 4 arrays as if 1 by swapping values between them (some optimizations can be made since you know the 4 arrays are sorted). Once you've sorted the arrays up to n/2 (where n is the aggregate length of the 4 arrays), just return the middle value of all 4.
Some Code
The implementation below begins to make multiple arrays function like a single one. I've implemented get
, set
, and length
methods, the basis for any array. All that needs to happen now is for the class' data to be sorted (possibly up to n/2) using get(int)
, set(int,int)
, and length()
, and a method which returns the median value median()
.
There is also room for further optimization by sorting only up to n/2 within the median method, also when caching (i,j) pairs for each element when doing so.
int median( int[] a1, int[] a2, int[] a3, int[] a4 )
MultiIntArray array = new MultiIntArray( a1, a2, a3, a4 );
array.sort();
return array.get( array.length() / 2 );
public class MultiIntArray
private int[][] data;
public MultiIntArray( int[]... data )
this.data = data;
public void sort()
// FOR YOU TO IMPLEMENT
public int length()
int length = 0;
for ( int[] array : data )
length += array.length;
return length;
public int get( int index )
int i = 0;
while ( index >= data[i].length )
index -= data[i].length;
i += 1;
return data[i][index];
public void set( int index, int value )
int i = 0;
while ( index >= data[i].length )
index -= data[i].length;
i += 1;
data[i][index] = value;
add a comment |
Think of a single unsorted array
Consider thinking about the 4 arrays as a single unsorted array, broken into 4 parts. If you can modify the arrays, you can sort all 4 arrays as if 1 by swapping values between them (some optimizations can be made since you know the 4 arrays are sorted). Once you've sorted the arrays up to n/2 (where n is the aggregate length of the 4 arrays), just return the middle value of all 4.
Some Code
The implementation below begins to make multiple arrays function like a single one. I've implemented get
, set
, and length
methods, the basis for any array. All that needs to happen now is for the class' data to be sorted (possibly up to n/2) using get(int)
, set(int,int)
, and length()
, and a method which returns the median value median()
.
There is also room for further optimization by sorting only up to n/2 within the median method, also when caching (i,j) pairs for each element when doing so.
int median( int[] a1, int[] a2, int[] a3, int[] a4 )
MultiIntArray array = new MultiIntArray( a1, a2, a3, a4 );
array.sort();
return array.get( array.length() / 2 );
public class MultiIntArray
private int[][] data;
public MultiIntArray( int[]... data )
this.data = data;
public void sort()
// FOR YOU TO IMPLEMENT
public int length()
int length = 0;
for ( int[] array : data )
length += array.length;
return length;
public int get( int index )
int i = 0;
while ( index >= data[i].length )
index -= data[i].length;
i += 1;
return data[i][index];
public void set( int index, int value )
int i = 0;
while ( index >= data[i].length )
index -= data[i].length;
i += 1;
data[i][index] = value;
add a comment |
Think of a single unsorted array
Consider thinking about the 4 arrays as a single unsorted array, broken into 4 parts. If you can modify the arrays, you can sort all 4 arrays as if 1 by swapping values between them (some optimizations can be made since you know the 4 arrays are sorted). Once you've sorted the arrays up to n/2 (where n is the aggregate length of the 4 arrays), just return the middle value of all 4.
Some Code
The implementation below begins to make multiple arrays function like a single one. I've implemented get
, set
, and length
methods, the basis for any array. All that needs to happen now is for the class' data to be sorted (possibly up to n/2) using get(int)
, set(int,int)
, and length()
, and a method which returns the median value median()
.
There is also room for further optimization by sorting only up to n/2 within the median method, also when caching (i,j) pairs for each element when doing so.
int median( int[] a1, int[] a2, int[] a3, int[] a4 )
MultiIntArray array = new MultiIntArray( a1, a2, a3, a4 );
array.sort();
return array.get( array.length() / 2 );
public class MultiIntArray
private int[][] data;
public MultiIntArray( int[]... data )
this.data = data;
public void sort()
// FOR YOU TO IMPLEMENT
public int length()
int length = 0;
for ( int[] array : data )
length += array.length;
return length;
public int get( int index )
int i = 0;
while ( index >= data[i].length )
index -= data[i].length;
i += 1;
return data[i][index];
public void set( int index, int value )
int i = 0;
while ( index >= data[i].length )
index -= data[i].length;
i += 1;
data[i][index] = value;
Think of a single unsorted array
Consider thinking about the 4 arrays as a single unsorted array, broken into 4 parts. If you can modify the arrays, you can sort all 4 arrays as if 1 by swapping values between them (some optimizations can be made since you know the 4 arrays are sorted). Once you've sorted the arrays up to n/2 (where n is the aggregate length of the 4 arrays), just return the middle value of all 4.
Some Code
The implementation below begins to make multiple arrays function like a single one. I've implemented get
, set
, and length
methods, the basis for any array. All that needs to happen now is for the class' data to be sorted (possibly up to n/2) using get(int)
, set(int,int)
, and length()
, and a method which returns the median value median()
.
There is also room for further optimization by sorting only up to n/2 within the median method, also when caching (i,j) pairs for each element when doing so.
int median( int[] a1, int[] a2, int[] a3, int[] a4 )
MultiIntArray array = new MultiIntArray( a1, a2, a3, a4 );
array.sort();
return array.get( array.length() / 2 );
public class MultiIntArray
private int[][] data;
public MultiIntArray( int[]... data )
this.data = data;
public void sort()
// FOR YOU TO IMPLEMENT
public int length()
int length = 0;
for ( int[] array : data )
length += array.length;
return length;
public int get( int index )
int i = 0;
while ( index >= data[i].length )
index -= data[i].length;
i += 1;
return data[i][index];
public void set( int index, int value )
int i = 0;
while ( index >= data[i].length )
index -= data[i].length;
i += 1;
data[i][index] = value;
edited Mar 22 at 1:22
answered Mar 22 at 0:53
Robert E FryRobert E Fry
1511313
1511313
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- 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.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
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%2fstackoverflow.com%2fquestions%2f55290460%2fmedian-algorithm-for-4-sorted-arrays%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');
);
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');
);
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');
);
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
3
Possible duplicate of Find median in four (individually) sorted arrays with O(1) space
– Matt Timmermans
Mar 21 at 23:38
The question linked dropped the explicit mention of
different sizes
. It has no useful answer as of this comment.– greybeard
Mar 22 at 6:52