• Register

Recent questions tagged algorithm

0 votes
0 answers 3 views
Problem: I need someone’s help to fix it .. How to find inverse of 4x4 matrix example
asked 4 hours ago Ifra 34.7k points
1 vote
1 answer 2 views
Problem: I wanted to know how can I draw a binary tree of this expression : A*(B-C+D)*P/Q
asked 19 hours ago Raj Tyagi 14.4k points
0 votes
0 answers 2 views
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?
asked 20 hours ago Yeamin 21.4k points
0 votes
0 answers 2 views
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
asked 22 hours ago Yeamin 21.4k points
0 votes
1 answer 1 view
Problem: I'm fresh on these term scheduling. I've become comfortable with identifying preemptive or non preemptive scheduling
asked 1 day ago ochena 22.1k points
0 votes
1 answer 3 views
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.
asked 1 day ago ochena 22.1k points
0 votes
1 answer 3 views
Problem: What is the fastest way to compute the greatest common divisor of n numbers?
asked 1 day ago sumaiya simi 43.9k points
0 votes
1 answer 3 views
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?
asked 1 day ago sumaiya simi 43.9k points
0 votes
1 answer 2 views
Problem: I will keep investigating myself, but please inform me if you can see better.
asked 2 days ago salim1 60.6k points
0 votes
1 answer 2 views
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?
asked 2 days ago anika11 32k points
0 votes
1 answer 3 views
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.
asked 2 days ago salim1 60.6k points
0 votes
0 answers 3 views
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?
asked 2 days ago Supti 12.7k points
1 vote
1 answer 2 views
Problem: I was curious so I wanted to know whether there is a problem that has only a recursive solution ?
asked 2 days ago Raj Tyagi 14.4k points
0 votes
1 answer 2 views
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.
asked 2 days ago sumaiya simi 43.9k points
0 votes
1 answer 2 views
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.
asked 3 days ago ochena 22.1k points
0 votes
1 answer 2 views
Problem: Please let me know any solution regarding this .. What does the upside down a mean in math?
asked 3 days ago Ifra 34.7k points
0 votes
1 answer 3 views
Problem: I am doing a code challenge where given two integers l and r, I have to print all the odd numbers between i and r (i and r inclusive). The function must return an array of integers denoting the odd numbers between l and r. This is what I have ... Wrong Answer Your Output (stdout) Output hidden Any ideas for this? on the QA of the challenge site, it seems related to Corner case problems.
asked 3 days ago anika11 32k points
0 votes
1 answer 2 views
Problem: I was going through this leetcode problem for going from top left to bottom right. How many possible unique paths are there?
asked 3 days ago sumaiya simi 43.9k points
0 votes
1 answer 3 views
Problem: Can someone please help fix this > Find missing number in array of size n containing numbers from 1 to n only
asked 3 days ago ummeshani 8.8k points
1 vote
1 answer 2 views
Problem: Can somebody help me with this &ldquo;Kth smallest element in a row-wise and column-wise sorted 2d array&rdquo; ?
asked 3 days ago Raj Tyagi 14.4k points