[Solved] question on array and number

Interesting problem. If the array is of signed integers, I believe it is possible in O(n) time and O(1) space, with no overflows, assuming the length is small enough to permit such a thing to happen. The basic idea is as follows: We have n numbers. Now on dividing those numbers by n+1, we get … Read more

[Solved] algorithm removing duplicate elements in array without auxillay storage

OK, here’s my answer, which should be O(N*N) worst case. (With smaller constant, since even worstcase I’m testing N against — on average — 1/2 N, but this is computer science rather than software engineering and a mere 2X speedup isn’t significant. Thanks to @Alexandru for pointing that out.) 1) Split cursor (input and output … Read more

[Solved] Fastest way to solve the divisibility of numbers [closed]

I propose a mathematical solution. Number of numbers divided by a is [n/a]. ([] is a floor function.) And about b, c, lcm(a, b), lcm(a, c), lcm(b, c), lcm(a, b, c) so is it. (lcm means least common multiple.) So the answer should be ([n/a]+[n/b]+[n/c])-([n/lcm(a,b)]+[n/lcm(a,c)]+[n/lcm(b,c)])+[n/lcm(a,b,c)] 7 solved Fastest way to solve the divisibility of numbers … Read more

[Solved] Program stopped working, when tried to run

You have your main problem here. double *tabT1; double *tabT2; tabT1[0]=1; tabT1[1]=tabX[j]*(-1); tabT2[0]=1; tabT2[1]=tabX[i]*(-1); You haven’t allocated the memory, instead, you have just declared the double ptrs tabT1 and tabT2 and accessing them by pretending you have allocated. double *tabT1 = new double[2]; double *tabT2 = new double[2]; will fix this, however, I strongly suggest … Read more

[Solved] eps estimation for DBSCAN by not using the already suggested algorithm in the Original research paper

Try using OPTICS algorithm, you won’t need to estimate eps in that. Also, I would suggest recursive regression, where you use the python’s best curve fit scipy.optimize.curve_fit to get best curve, and then find the rms error of all the points wrt the curve. Then remove ‘n’ percent of points, and recursively repeat this untill … Read more

[Solved] eps estimation for DBSCAN by not using the already suggested algorithm in the Original research paper

Introduction The DBSCAN algorithm is a popular clustering algorithm used for data mining and machine learning. It is a density-based clustering algorithm that is used to identify clusters of points in a dataset. However, the original research paper on DBSCAN suggested an algorithm for estimating the epsilon parameter, which is an important parameter for the … Read more

[Solved] My code is showing error [closed]

The key is item 7: For example, if Config.MIN_ACTION is 1 and Config.MAX_ACTION is 3: If the action rankings are {9,90,1} the total is 100. Since actionRanking[0] is 9, then an action of picking up 1 should be chosen about 9/100 times. 2 should be chosen about 90/100 times and 1 should be chosen about … Read more

[Solved] What will be the algorithm to solve the given series?

try to separate the coefficients from polynomials and calculate those in separate methods. Example: public class NewClass { public static void main(String[] args) { int greatestExponent = 9; double x = 0.5; System.out.println(calculate(x,greatestExponent)); } public static double getCoefficient(int n){ double coff = 1; for(int i=1; i<n; i++){ if(i%2==0){ coff = coff/i; //if even put it … Read more

[Solved] Computing the overtimepay is my formula correct?

Your calculation is alright (not that complicated after all!), I’d just suggest to change your condition statement to reduce a bit your code: double hours, overtimepay, wage; printf(“Enter number of hours: “) scanf(“%f”,&hours); wage=9.73*hours; wage = 9.73 * hours; printf(“Your wage is: %f\n”,wage); if(hours > 40) { overtimepay = (9.73*(hours-40))*1.5; printf(“Your overtime pay is: %f\n”, … Read more

[Solved] Does there exist an algorithm for iterating through all strings that conform to a particular regex?

Let’s say the domain is as following String domain[] = { a, b, .., z, A, B, .. Z, 0, 1, 2, .. 9 }; Let’s say the password size is 8 ArrayList allCombinations = getAllPossibleStrings2(domain,8); This is going to generate SIZE(domain) * LENGTH number of combinations, which is in this example (26+26+10)^8 = 62^8 … Read more