algorithm

algorithm to convert a number in an unknown base to the equivalent base 10 number [duplicate]

大城市里の小女人 提交于 2019-12-14 04:24:03
问题 This question already has an answer here : Closed 7 years ago . Possible Duplicate: Efficient algorithm for conversion between numeral system Given an integer, write a program that converts the given number to a number (in base 10). Hint - The given number could be in any base, but the base is

Google maps polygon optimization

半腔热情 提交于 2019-12-14 04:16:56
问题 I extracted country outline data from somewhere and successfully managed to convert it into an array of lat-lng coordinates that I can feed to Google maps API to draw polyline or polygons. The problem is that that there are about 1200+ points in that shape. It renders perfectly in Google maps but

Counting Positive Integers with a Given Number of Divisors

坚强是说给别人听的谎言 提交于 2019-12-14 04:15:13
问题 basically what i was trying to do is insert an integer k that represents the number of divisors and then finding all the numbers that have k divisors from 1-100000 #include <stdio.h> int main(void) { int k, x = 1, y = 100000, divisor, count; printf("Enter the target number of divisors:\n"); scanf

Can someone tell me the Complexity of the Addition & Subtraction for the Divide & Conquer Matrix Multiplication algorithm?

核能气质少年 提交于 2019-12-14 04:14:44
问题 Can someone tell me the Complexity of the Addition & Subtraction for the Divide & Conquer Matrix Multiplication algorithm? I know that the complexities of addition and subtraction operations of the Classic matrix multiplication are (n^3-n^2) while Strassen’s is 6n^2.81 – 6n^2... but I can't seem

What is an efficient algorithm to find all the factors of an integer?

爷,独闯天下 提交于 2019-12-14 03:55:55
问题 I was writing a very simple program to examine if a number could divide another number evenly: // use the divider squared to reduce iterations for(divider = 2; (divider * divider) <= number; divider++) if(number % divider == 0) print("%d can divided by %d\n", number, divider); Now I was curious

Algorithm for Combinations of given numbers with repetition? C++

我是研究僧i 提交于 2019-12-14 03:54:21
问题 So I N - numbers I have to input, and I got M - numbers of places for those numbers and I need to find all combinations with repetition of given numbers. Here is example: Let's say that N is 3(I Have to input 3 numbers), and M is 4. For example let's input numbers: 6 11 and 533. This should be

Given an array with integer 0 to N, how many ways to arrange it such that array[i] cannot be i

折月煮酒 提交于 2019-12-14 03:53:11
问题 Given an array with integer 0 to N, how many ways to arrange it such that at position i of the array, we cannot have i inserted in it? For example, N = 2 The following arrangements is valid: 1,2,0 2,0,1 Thus, the answer is 2 arrangements I can't think of a non-brute force method to do this in O(1