Posts by Marcelo de Sousa • 632 points
24 posts
-
0
votes0
answers26
viewsQ: Error compareTo Key
Save people, I have the following problem, I am implementing a code that returns me the median of a sequence, using max-heap and min-heap. Even before completing the code the compiler returned me an…
-
0
votes1
answer849
viewsQ: Switch chained list pointers - python
I created a function to change the pointers of a chained list, the idea is very simple, change them and update the next element so that it does not lose the reference, only that the function is…
-
1
votes1
answer168
viewsQ: Function removes chained list
Save everyone, I’m learning chained list in python, as I already have some knowledge of list in C hit me doubt about node removal, the basis of the algorithms I used in some exercises is this:…
-
0
votes2
answers920
viewsQ: Turn string into operator
I have the following string '1+1', I have to transform the numbers into integers and perform the operation, have to transform the string '+' into the operator +, or other operators like '*' made a…
-
3
votes1
answer531
viewsQ: Cycles in graphs
I am creating an algorithm that identifies whether a graph contains cycles excluded from the sources recursively, returning the graph for later verification of the edge quantity, so create the…
-
0
votes1
answer510
viewsQ: Counter of recursion solutions
Hi, I made a recursive Sudoku program, it’s working fine, but I’d like to add a solution counter, I’ve tried numerous code changes that would make it possible, but it didn’t work, finally I tried a…
-
0
votes1
answer340
viewsQ: Polynomial class - list assignment index out of range
Save people, I’m learning classes in python and created one for application with polynomials, but I’m not able to add two distinct polynomials, always appears the following error: File…
-
0
votes2
answers469
viewsQ: Sum recursive sequence
I am implementing a recursive code that adds the following sequence: x + x 2 / 2 + x 3 / 3... x n / n, for this sum, I thought of a definition, combining two recursive functions, as follows below,…
-
0
votes1
answer102
viewsQ: Subtleties between Python and C
Good night! Sunday I discovered that I must learn Python, that the subject I will attend will be in that language and there is no way out. I studied well this week and managed to get to matrices,…
-
2
votes1
answer77
viewsQ: Insert function does not work
I am building a chained list to save a string with the following signature on the record: typedef struct Lista *Noticia; struct Lista { int hora; char *Texto; struct Lista *PN; }; And insert the…
-
1
votes1
answer3225
viewsQ: Count nodes in binary trees
Good evening, I’m studying binary trees and I came across an exercise that asks me to count the knots. I did it by adapting an algorithm that calculates height and works... int conta_nos (arvore *r)…
-
3
votes1
answer469
viewsQ: Chained list, union of structures
I have some difficulty in uniting two structures in the same chained list, I have never worked with generic lists or even associated in one activity two structures, I have the following structures:…
-
0
votes1
answer198
viewsQ: Error loading file to chained list
This code carries elements from a file. txt, but apparently it can load the file information, but it gives some error in inserting the list, but I’m not able to identify. Follow the code and file…
-
6
votes3
answers234
viewsQ: Global variables recursion
I’m learning recursion and have doubts about using global variables, particularly I think a gambit inelegant, maybe I’m wrong. I made a code to add positive numbers and used a variable called sum. I…
-
3
votes1
answer42
viewsQ: Even zeroed sum
This function should add the pair, but it is not, I did not understand the pq. #include <stdio.h> int somapar(int vet[], int n) { int soma = 0, i; for (i = 0; i < n; i++) { if (vet[n] % 2…
casked Marcelo de Sousa 632 -
5
votes5
answers11043
viewsQ: Recursive Fibonacci printing
I’m having problems with the recursive function Fibonacci, in the exercise you ask to print inside the function or even using an auxiliary recursive function, but you can’t print in the main…
-
2
votes3
answers6084
viewsQ: Recursive palindromus C
My functions are not working properly, always the program tells me that it is not palindromic, for any situation. Follow the code: #include<stdio.h> #include<string.h> int inverte (char…
-
2
votes2
answers2251
viewsQ: Chained list - remove function
I am programming a chained list without head, in this program there is a remove function that aims to eliminate all the repeated integers in a list, px: taking the values 8 2 8 3 the function has to…
-
1
votes1
answer395
viewsQ: Chained list without head, intersection function problem
I’m doing a series of function with chained list without head, but a function called Intersection is not working properly, the problem compiles without errors but this function specifically does not…
-
0
votes1
answer265
viewsQ: Output of a void function
I’m programming a word hunt and a problem in the void function is making it difficult. In the code I use functions to scan the matrix in all directions and returns me the initial and final…
-
4
votes1
answer239
viewsQ: How do I get rid of these warnings
I’m doing a program that hunts a word from a matrix. For this I made 8 functions that sweep in all regions, as I need to return in the output the coordinates of the first and last letter. For…
-
1
votes1
answer97
viewsQ: Matrix initialization error
I don’t understand this error in the matrix. #include<stdio.h> #include<stdlib.h> #include<math.h> #define MAX 800 int main () { float ponto[MAX][MAX]; float i, j, n, y, x, aux_st,…
-
11
votes2
answers3185
viewsQ: Binary search in chained list
How can I perform a binary search on a simple chained list with head? Also if it is possible to do this, if there is some special method. In the EP I can not count beforehand the amount of elements…
-
3
votes1
answer762
viewsQ: Chained list - sort by selection
I am playing a sorting algorithm by selection using chained list. I’m using two loops using a min cell, i and j, with respect to cell j, ok, but at the time of changing the min pointers and i is not…