algorithm Questions

8

Solved

I have an guaranteed to be a perfect square matrix. I want to start at the center of the matrix in this case it would be matrix[2][2], I know how to figure the center (int)(dimensions / 2). I need ...
Wilek asked 13/11, 2015 at 2:27

5

Solved

I have a loop of instructions, such as (pseudocode): for i = 1 to 1000000 // Process the ith input doSomething(input[i]) end This takes a long time to complete. I would like to output some kin...
Raincoat asked 20/8, 2012 at 0:44

6

Solved

I have this memoization technique to reduce the number of calls getting a Fibonacci sequence number: def fastFib(n, memo): global numCalls numCalls += 1 print 'fib1 called with', n if not n i...
Sphingosine asked 10/4, 2015 at 21:20

10

I'm trying to solve this problem of Union-Find which goes like Successor with delete. Given a set of N integers S={0,1,…,N−1} and a sequence of requests of the following form: Remove x from ...
Inviolable asked 17/3, 2017 at 15:7

16

Solved

There is a lot of information on how to find the next power of 2 of a given value (see refs) but I cannot find any to get the previous power of two. The only way I find so far is to keep a table w...
Speech asked 21/4, 2010 at 1:50

4

Solved

Hi I have a question about Batcher's odd-even-merge sort. I have the following code: public class Batcher { public static void batchsort(int a[], int l, int r) { int n = r-l+1; for (int p=1; p...
Compatible asked 30/5, 2010 at 10:48

3

Solved

I have already solved the problem using mergesort, now I am thinking is that possible to calculate the number using quicksort? I also coded the quicksort, but I don't know how to calculate. Here is...
Baggy asked 29/10, 2013 at 8:5

2

Solved

I was going through a book that explained the xorshift algorithm (I know, basic stuff). Then, while searching a little bit more on the Internet, I found that all the basic examples seem to shift th...
Polyhydroxy asked 18/3, 2022 at 5:29

7

Solved

Can someone give an example for finding greatest common divisor algorithm for more than two numbers? I believe programming language doesn't matter.
Illiquid asked 5/8, 2009 at 7:49

3

Solved

I'm working on implementing various subdivision algorithms (such as catmull-clark); to do this efficiently requires a good way to store information about a grid of tesselated polygons. I implemente...

4

Solved

I am interested in the scenario where we have some function f which is recursive and which we are not provided the source code to. I would like a function memoizer: Function -> Function which tak...
Sewellyn asked 18/10, 2018 at 19:56

7

The Scenario I have several number ranges. Those ranges are not overlapping - as they are not overlapping, the logical consequence is that no number can be part of more than one range at any time....
Haskel asked 28/7, 2009 at 11:25

12

Solved

I have an array which carry some integer numbers. Say,numbers={3,0,1} or say, numbers={9,6,4,2,3,5,7,0,1}. Now I have to find out the missing numbers from the array. As per this example there is on...
Eth asked 17/12, 2018 at 22:1

22

Solved

Given an array of integers, find the pair of adjacent elements that has the largest product and return that product. and here is my code function adjacentElementsProduct(inputArray) { var arr = in...
Acaricide asked 28/10, 2017 at 14:3

1

I am using Wasabi as S3 storage for my project, and I've been thinking of utilizing S3 as key-value, storage. Wasabi does not charge on API requests as noted here https://wasabi.com/cloud-storage-p...
Wooton asked 12/6, 2020 at 2:27

7

Solved

Problem I have a group of people, and I want each person to have a 1:1 meeting with every other person in the group. A given person can only meet with one other person at a time, so I want to do t...
Loquacious asked 1/7, 2018 at 4:28

6

I have visited many websites but couldnt find any algorithm for Morris postOrder traversal. I know that we can use Morris algorithm for preOrder and inOrder.It will be of great help if someone poin...
Ulibarri asked 3/4, 2016 at 10:57

10

Solved

I think this might be a classic question but I am not aware of an answer. Can a program output a copy of itself, and, if so, is there a short program that does this? I do not accept the "emp...
Nanon asked 25/9, 2009 at 20:45

4

Solved

I have two large numpy arrays of randomly sorted 2d points, let's say they're A and B. What I need to do is find the number of "matches" between the two arrays, where a match is a point in A (call ...
Crooks asked 16/6, 2020 at 3:22

9

Solved

I am trying to implement a randomly generated maze using Prim's algorithm. I want my maze to look like this: however the mazes that I am generating from my program look like this: I'm current...
Variation asked 20/4, 2015 at 5:13

3

I was comparing Token bucket and Fixed window rate limiting algorithm, But a bit confused with traffic bursts in both algorithm. Let's say i want to limit traffic to 10 requests/minute. In Token bu...
Codee asked 24/1, 2021 at 8:0

13

Solved

Suppose I have an array of points in random order, and I need to find a polygon (by sorting them, such that every adjacent pair represents a side) which passes through all of the points, and its si...
Marozas asked 10/1, 2013 at 17:4

1

The task is like How to set bits of a bit vector efficiently in parallel?, but for CUDA. Consider a bit vector of N bits in it (N is large, e.g. 4G) and an array of M numbers (M is also large, e.g....
Picofarad asked 27/7, 2022 at 7:12

5

Solved

I have the following problem - made abstract to bring out the key issues. I have 10 points each which is some distance from the other. I want to be able to find the center of the cluster i.e. t...
Fini asked 10/8, 2009 at 8:52

5

Solved

I know that logistic regression is for binary classification and softmax regression for multi-class problem. Would it be any differences if I train several logistic regression models with the same ...

© 2022 - 2024 — McMap. All rights reserved.