Hi basically i need help , i am not good with c++ but i am trying my very best. i am currently stuck with trying to do an infix to postfix conversion that reads from a textfile. The text file contains the infix notations and the code is suppose to convert the infix to postfix notations and then solve it. My code displays the contents of the text file fine but i am lost on how to connect it with my converting code. If anybody can help i would greatly appreciate it. for example the text file infix.txt would contain … |
+0 forum
2 | ||

How to calculate time complexiy of the following line of code using 'Big-O' or 'Big-OH' notation??? 1. scanf("%d",&n); 2. for(i=1,m=n+66;i<=m;i++) 3. printf("%d \n",i); 4. for(j=n/21,m=n/5;j<=m;j++) 5. printf("%d \n",j); I have basic idea but i am getting confused...So, please help me to calculate time complexity of each step, plus overall complexity. i have gone through some books and sites but, the explanation is very complex......:( And according to me the time comlexity of each step is, 1. 1 2. 1+1+(m+1)+(m) // may be true or not 3. 1 4. O(log n) // i know this is wrong 5. 1 PLEASE, correct … |
+0 forum
4 | ||

If anyone can help me finish this and point out what had to be done to make the program work, that would be great. -ask for how many days user wants to enter from 1-365 (validate) -ask for temperature for each days between -60 and 90 degrees celsius (loop, validate) -convert each value to fahrenheit (funtion) -output results (function) Problem -the users should input a int celsius number, a whole number but it converts to a double fahrenheit number - for this code cout << "Celsius temperature for Day " << i+1 << " : "; *(days + 1) = … |
+0 forum
1 | ||

how you would compute/denote the time complexity of two loops based on different variables? I understand how to compute the time complexity for a simple loop PseduoCode while X<N { while Y<M { Z++ } X++ } one loop occurs N times - time complexity O(N) the other loop occurs M - time complexity 0(M) M- happens to be a unknown function of N would the time complexity O(MN)? but In big O notation you are to drop all excess variables in which case time complexity would be O(N)? or neither? please help |
+0 forum
5 | ||

I see that there are many questions here regarding complexity analysis, specifically regarding the Big-O notation of algorithms. I will attempt to shed some light on the subject. I will start with an introduction, after which I will go over some common complexities and last we will solve a few simple examples for practice. [U][B]1. Introduction[/B][/U] When looking at the Algorithm, we want to know its order of growth regarding the input size given to it. Consider two simple algorithms that sort an array of [TEX]n[/TEX] cells. The first algorithm is doing [TEX]n[/TEX] operations in order to complete the sort, … |
+13 forum
11 | ||

Hello everyone, it's my first time posting here and it's an urgent matter as I need the solution to this by midnight tonight :/ I'm really struggling with the all Big-Oh notation thing and I could really use your help. I have this C++ code: [CODE]void Teste::listarMaisAfastados() { int maior = 0; Utilizador maiorX, maiorY; for (int i = 0; i <= utilizadores.NumVert(); i++) { Utilizador tmpUL = utilizadores.getVerticeById(i); for(int y = 0; y <= utilizadores.NumVert(); y++) { Utilizador TmpYL = utilizadores.getVerticeById(y); int tmp = utilizadores.distancia(tmpUL, TmpYL, false); if(tmp > maior) { maior = tmp; maiorX = tmpUL; maiorY = … |
+0 forum
5 | ||

Hi, Is there anyone who know which complexity these functions are? I mean O(n), O(n^2), O(n^3), n log(n) or log(n) 1. --------------------------------------------- [CODE]void bogosort_array(double a[], int length) { do shuffle_array(a, length); while (! is_array_sorted(a, length)); }[/CODE] 2. --------------------------------------------- [CODE]void reverse_string(char* s) { int n = strlen(s); for (int i = 0; i < n / 2; ++i) { char temp = s[i]; s[i] = s[n - i - 1]; s[n - i - 1] = temp; } } [/CODE] 3. ------------------------------------------------------------- [CODE]double arrays_are_equal(double a[], double b[], int length) { for (int i = 0; i < length; ++i) { if … |
+0 forum
2 | ||

Hey folks :) I am studying for my final exam, and I have some issues with this Big Oh notation. Really - I've been reading about it like crazy, but I just can't to understand it all properly. What I know is that it is some kind of measurement of growth rate. How much time it takes for a certain input to be computed. And I can't seem to grasp how it really is measured with loops. If I have a loop like this: for(int i = 0; i < 10; i++) do this... then I know it's the problem … |
+0 forum
10 |

The End.