Array Algorithms are defined as functional algorithms where each step of the algorithm results in a function being applied to an array, producing an array result
1
vote
4answers
181 views
sublists of a list with possitive sum
I'm trying to find the sublist of a list (with at least one positive integer) with the following 2 properties
1. the sum of it's elements is positive
2. it has the maximum length of all the other sub ...
0
votes
4answers
133 views
Sorting array algorithm - duplicate values
I have an Integers array size N with duplicates values and I don't know the range of the values.
I have n/logn Different values in this array, and all the rest are duplicates.
Is there a way to sort ...
2
votes
2answers
258 views
Find Possible addition combinations in array
What is the best way to approach this problem? I have no idea on how to start. This is not a homework problem, but rather practice for interviews.
'Using the JavaScript language, have the function ...
0
votes
2answers
71 views
Find all number pairs in a given range
I have N numbers let say 20 30 15 30 30 40 15 20. Now I want to find how many numbers pairs are in a given range.(L and R given).
number pair= both numbers are same.
My approach:
Create a Map of ...
0
votes
1answer
339 views
Merge sort using one array
My merge sort algorithm is given below...
As we know this algorithm needs extra memory. Is there any way to do sorting with only one array? (Sorting in a single array.)
My merge sort algorithm is:
...
0
votes
1answer
95 views
How to find median of m sorted arrays?
How to find the median of M sorted arrays of integers? Where the size of each array is bounded by N. Assume that each array contains sorted integer elements.
There are two variation of this question.
...
0
votes
1answer
130 views
Is linear prefix average method better than quadratic prefix average method?
I've created a method (based on pseudocode I found online) to compute prefix averages for an array but I'm not sure I've satisfied the requirement.
The requirement is:
Given an array a[1…n] of ...
-1
votes
1answer
409 views
implementing Brute Force in c++
I have a problem that deals with optimization of a game that includes 2 players.
So we have an undirected connected graph with a number of edges and some vertices.
Each player has to remove edges and ...
0
votes
0answers
41 views
How to use a Linear Search in this particular instance in C#?
I'm reading a text file of dates like this
string[] Date = System.IO.File.ReadAllLines("Date.txt");
I am then converting them like this
DateTime[] Dates = Array.ConvertAll(Date, s => ...
0
votes
0answers
68 views
Improving quicksort to sort in linear time?
Can we sort unsorted array of real numbers in linear time?
This is what I am thinking :
Given an unsorted array of size n :
Find out the sqrt(n)^th element using selection algorithm (call it x): ...
0
votes
0answers
80 views
ith order statistic with bandwidth constraint
Consider the following: Mary and Larry each have an array, M [1,..., n] and
L[1,..., n] respectively. All of the elements in M and L are distinct. Mary and
Larry are interested in finding the i th ...
0
votes
0answers
34 views
Optimize / redesign this java code
folks.
I need help or advice on decision making about a a design pattern (or sort of such) to uuse:
Have an application, running on weblogic via EJBs. Part of application deals with the the very ...
-1
votes
0answers
33 views
MAXOR operation for elements in array
Can someone please guide me in understanding this puzzle. The editorial is really bad. Why should I xor the digits from 1 to 128 with array[i] ?
...