An algorithm is a sequence of well-defined steps that defines an abstract solution to a problem. Use this tag when your issue is related to algorithm design.
1
vote
0answers
13 views
Given an input array find all subarrays with given sum K
Given an input array we can find a single sub-array which sums to K (given) in linear time, by keeping track of sum found so far and the start position. If the current sum becomes greater than the K ...
-1
votes
2answers
30 views
Amortized performance of LinkedList vs HashMap
The amortised performance of Hash tables is often said to be O(1) for most operations.
What is the amortized performance for a search operation on say a standard LinkedList implementation? Is it ...
1
vote
2answers
28 views
Calculating points in a circle - step size?
I'd like to calculate all points in a circle. I already know I can calculate points using x = r * cos(theta) + x0, y = r * sin(theta) + y0 - however I was wondering if there is a nice way to find an ...
0
votes
2answers
42 views
scala functional quick sort
In the chapter 2 of the book http://www.scala-lang.org/docu/files/ScalaByExample.pdf, M. Odersky wrote following implementation of quick sort
def sort(xs: Array[Int]): Array[Int] = {
if (xs.length ...
0
votes
1answer
17 views
mix left-add multiplier, school book algo for signed multiplication
I am trying to produce an efficient extended multiplication in assembly language. Although my code works well, I have some issue with a signed multiplication. Presently, my number are based on the two ...
0
votes
0answers
16 views
Adaptive product specification filtering?
I am working on an ecommerce application and ran into an issue.
The Product entity has a field "CompiledSpecifications" where I have stored all the Key--Value pairs of properties describing a product ...
0
votes
1answer
18 views
algorithm/query to get statistical data from table using php/mysql
I have the following table structure:
CREATE TABLE test(
myID INT,
num1 INT,
num2 INT,
num3 INT,
PRIMARY KEY (myID)
)engine=innodb;
now i have the following data in the table:
myID ...
1
vote
1answer
37 views
Storing values for future math with javascript
Evening gents, I got a tough one, and im not sure if this is the correct way to go about this or not but here goes... basically im creating a dynamic calendar, and currently im working on the month ...
0
votes
0answers
34 views
Single Precision Floating Point Operations in MATLAB
I am trying to performing single precision (IEEE-754 2008) floating point operations like multiplication, addition, and subtraction in MATLAB.
However, MATLAB performs its operations in double ...
2
votes
9answers
110 views
Find duplicate element in array in time O(N)
i have been asked this question in a job interview and i have been wondering about the right answer.
you have an array of numbers from 0 to N-1, one of the numbers is removed, and replaced with a ...
-7
votes
0answers
48 views
Quantopian coding [closed]
Hey I have always been interested in algorithmic trading but never has there been a tool to make it as easy as this. That being said, I cant program in python and am completely lost. However, I have ...
2
votes
3answers
43 views
Ouput all possibilities, could be three int number as example belowed
Given a sorted array, output all triplets such that a-b=c, the example of array is: {-24, -15, -8, -6, 0, 3, 6, 9, 17, 36}
1
vote
0answers
26 views
Sending appropriate json input to plugin
I am using a third party javascript plugin to develop a two-column table functionality as per my requirements. The plugin accepts an input json array which looks something like the following:
var ...
1
vote
1answer
46 views
Algorithm to identify marked similarities in html
I would like to find similarities (exactly the patterns of it) in one or more
HTML pages without knowing thier structure.
Lets talk about a really simplified example where the content and all ...
-3
votes
1answer
57 views
Tetrahedron Division [closed]
Given a regular tetrahedron. All the edges were divided into N equal segments. How many non-degenerate (|volume|>0) tetrahedrons with vertices at the points of division can be built inside this ...