# Recent questions tagged algorithm

Problem: I need someone&rsquo;s help to fix it .. How to find inverse of 4x4 matrix example
1 vote
Problem: I wanted to know how can I draw a binary tree of this expression : A*(B-C+D)*P/Q
Problem: I want to check if a vector of integers has any duplicates or not, and have to return true if it does. So I try to do something like this: vector<int> uGuess = {1,2,3,3,4,5} vector<int> a = uGuess; sort(a.begin(), a.end()); bool d = unique(a. ... be assigned as a bool value. How should I proceed towards this? If I were to write a for loop to perform the same action, how should I do that?
I am confused with the concept of constant time/space complexity. For example: public void recurse(int x) { if(x==0) return; else recurse(x/10); } where, 1<x<=2147483647 If we want to express the space complexity for this function in terms of big O notation ... If the number of elements is known in advance and does not change, however, such an algorithm can still be said to run in constant time
Problem: I'm fresh on these term scheduling. I've become comfortable with identifying preemptive or non preemptive scheduling
Problem: I have two task - count 1's in binary representation in O(n) and O(log n). As the first part is easy, I can't figure out how can I count them in O(log n) as it's not sorted or anything. Is that even possible? My code so far: public class ... ) { numberOfOnes++; } } System.out.println(numberOfOnes); } } I have found: Count number of 1's in binary representation but it's slightly different.
Problem: What is the fastest way to compute the greatest common divisor of n numbers?
Problem: This c++ code prints out the following prime numbers: 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97.But I don't think that's the way my book wants it to be written. It mentions something about square root of a number. So I did try ... <sqrt(i); j++) but it did not give me the result I needed.How would I need to change this code to the way my book wants it to be?
Problem: I will keep investigating myself, but please inform me if you can see better.
Problem: I want to check if a vector of integers has any duplicates or not, and have to return true if it does. So I try to do something like this: vector<int> uGuess = {1,2,3,3,4,5} vector<int> a = uGuess; sort(a.begin(), a.end()); bool d = unique(a. ... be assigned as a bool value. How should I proceed towards this? If I were to write a for loop to perform the same action, how should I do that?
Problem: I do not know where the error is (it is a logical error but I could not Identify it). I tried to debug it many times but still I could not find what causes it. Advance thanks.for any help.
Problem: How would you go about testing all possible combinations of additions from a given set N of numbers so they add up to a given final number?
1 vote
Problem: I was curious so I wanted to know whether there is a problem that has only a recursive solution ?
Problem: I am unable to "Print all possible paths from top left to bottom right of a mXn matrix" by using Dynamic Programming . In mostly site i saw it was done by recursion with give exponential time complexity. Can any provide me any reference or any link to create a c++ ... right or down in matrix at any step. As i said i am unable to understand means i am not started any thing in this.Thanks.
Problem: Suppose we are given n sets and want to construct all minimal sets that have at least one element in common with each of the input sets. A set S is called minimal, if there is no admissible set S' that is a subset of S. An example: In: s1 = {1, 2, ... It would be acceptible if the algorithm runs in O(n^2), but it should be basically linear (maybe with a log multiplier) of the output sets.