Posts by Hatus Daniel • 102 points
5 posts
-
2
votes1
answer895
viewsQ: Measure memory usage in c
Hi, can I measure the use of ram memory of a program made in c? Do you have any specific tool or something like?
-
1
votes2
answers679
viewsA: Strings and Arrays, problems getting the right result
José, working with strings and char in c is very boring, but with some tricks you’ll get used. Although you haven’t explained it very well, what I imagine must be happening is that you are…
-
1
votes1
answer501
viewsQ: Which code has the highest cost? (Bubblesort in C)
void bubblesort(int *A, int n) { int i, aux; for(i=0; i<n-1; i++){ if(A[i]>A[i+1]){ aux = A[i]; A[i] = A[i+1]; A[i+1] = aux; } } if(n-1>1) bubblesort(A, n-1); } void bubblesortI(int *A, int…
casked Hatus Daniel 102 -
2
votes2
answers1175
viewsA: How to get the representation of a positive integer in binary, using recursion?
#include <stdlib.h> void binario(int n){ if(n!=1) binario(n/2); printf("%d", n%2); } int main(){ int n; scanf("%d%*c", &n); binario(n); } My solution is simple, but it worked for the…
-
2
votes1
answer159
viewsQ: Is this code O(n)?
#include <stdlib.h> #include <time.h> int maior(int n, int A[]){ if(n==1) return A[0]; if(maior(n-1, A)<A[n-1]) return A[n-1]; else return maior(n-1,A); } int main(){ int n, i;…
casked Hatus Daniel 102