Recent content by zorro
-
Z
Loop Running Time: O(n) Not O(n2)
That does not work with duplicates.- zorro
- Post #8
- Forum: Programming and Computer Science
-
Z
Loop Running Time: O(n) Not O(n2)
So this is a comparison based sort, right?- zorro
- Post #6
- Forum: Programming and Computer Science
-
Z
Loop Running Time: O(n) Not O(n2)
I tried the output for 1 3 4 2 0 and found that the While loop executes 4 times only for i=0, it doesn't execute for other i's. The output was sorted. This of course took O(n) time. Isn't the worst case complexity of comparison based sorting algorithms O(nlogn)?- zorro
- Post #3
- Forum: Programming and Computer Science
-
Z
Loop Running Time: O(n) Not O(n2)
Can someone explain why the running time of following piece of pseudo code is O(n) and not O(n2)? for i := 0 to n - 1 while A[A[i]] != A[i] swap(A[i], A[A[i]]) end while end for The for loop executes at most n times and the inner while loop executes at most n-1 times...- zorro
- Thread
- Loop Running Time
- Replies: 11
- Forum: Programming and Computer Science
-
Z
Why Does One C Hash Table Implementation Fail While the Other Succeeds?
Can some one explain me the difference between the following two pieces of code ? First one doesn't work. I debugged it and made it to work but I am unable to understand how. The lines with changes have been made red bold.#include <stdio.h> #include <string.h> #include <stdlib.h> #define SIZE...- zorro
- Thread
- Replies: 3
- Forum: Programming and Computer Science
-
Z
What updates can we expect for the new PF website style?
Bad Design! Poor design. Looks like those adware websites. Earlier look was classy.- zorro
- Post #86
- Forum: Feedback and Announcements
-
Z
Sparse Matrix using linked list of a linked list
firstcell is a pointer to the first non zero valued cellnode. Thank you! I did not know that.- zorro
- Post #13
- Forum: Engineering and Comp Sci Homework Help
-
Z
Sparse Matrix using linked list of a linked list
I got my code working. Below if the final version. If I need to improve on something please let me know. #include <stdio.h> #define MAX 20 static struct cellnode *a[MAX]; static int k=0; struct cellnode { int val; int col; struct cellnode *nextcell; }; struct rownode...- zorro
- Post #11
- Forum: Engineering and Comp Sci Homework Help
-
Z
Sparse Matrix using linked list of a linked list
This is an assignment, and my professors won't help. I just used one global variable head2. That's how we did in class for a single linked list. Here we have a single linked list of rownodes. Attached is the .txt file containing input matrix. Every time the end of a row is reached, i.e. a...- zorro
- Post #10
- Forum: Engineering and Comp Sci Homework Help
-
Z
Sparse Matrix using linked list of a linked list
I modified my program as per your suggestion. It works pretty good before the display() function is called, where it gives a segmentation fault. I spent hours debugging it but came up with no error. #include <stdio.h> #define MAX 20 static struct cellnode *a[MAX]; static int k=0;struct...- zorro
- Post #7
- Forum: Engineering and Comp Sci Homework Help
-
Z
Sparse Matrix using linked list of a linked list
I hope you understood my problem. In the following code snippet: void link2(int r){ struct rownode *temp,*new; new=create_rownode(); new->row=r; new->firstcell=head1; new->nextrow=NULL;... the firstcell of the newly created node should point to the first non zero valued node of the...- zorro
- Post #5
- Forum: Engineering and Comp Sci Homework Help
-
Z
Sparse Matrix using linked list of a linked list
Isn't the firstcell of row node structure itself a head pointer to the first non-zero valued node of cell node?- zorro
- Post #4
- Forum: Engineering and Comp Sci Homework Help
-
Z
Sparse Matrix using linked list of a linked list
bump.- zorro
- Post #2
- Forum: Engineering and Comp Sci Homework Help
-
Z
Sparse Matrix using linked list of a linked list
Homework Statement The idea is to create following type of structure: first_row_with_a_nonzero_cell->next_row_with_a_nonzerocell->...->NULL rowN_with_a_nonzerocell->firstnonzerocolinrowN->nextnonzerocolinrowN...->NULL Input file is a 20x50 sparse matrix. The only problem I have is...- zorro
- Thread
- List Matrix
- Replies: 12
- Forum: Engineering and Comp Sci Homework Help
-
Z
Graduate Why Is the Fourier Sine Series Not Defined at Discontinuous Points?
Why is Fourier sine series of any function satisfying Dirichlet's theorem, not defined on the discontinuous points whereas we define it for Fourier cosine series? ex - sine series of f(x) = cosx, 0<=x<=∏ is defined on 0<x<∏ whereas cosine series of f(x) = sinx, 0<=x<=∏ is defined on 0<=x<=∏- zorro
- Thread
- Fourier Fourier series Interval Points Series
- Replies: 1
- Forum: Differential Equations