Questions tagged [tideman]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
32 views

Are boolean variables left uninitialized true or false?

I have a question about why something is being done in the provided stub code for Tideman. here bool locked[MAX][MAX] is left uninitialized early in the program when it is declared. Later every ...
Yuya Ito's user avatar
0 votes
0 answers
46 views

Tideman voting method: Who will win if ballots are cast like this?

Could you please help me with the pset3 Tideman? I am struggling to debug my lock_pairs function, and although this is not exactly a question about coding, I would like to know who the winner will be ...
Yuya Ito's user avatar
0 votes
0 answers
23 views

Pset3 tideman error at lock_pairs

void lock_pairs(void) { int cycle = 0; int winner; for(int i = 0; i < pair_count;i++) { locked[pairs[i].winner][pairs[i].loser] = true; if (pairs[i].loser == pairs[i+...
Ahmed Yehya's user avatar
0 votes
0 answers
32 views

Tideman PSET03 - lock_pairs ERROR

I'm currently doing the Tideman PSET03 and I've completed almost everything except ``. Could you tell me why this is happening? It'd appreciated. Check50: https://submit.cs50.io/check50/...
AlvaroAndLukeTheCoder's user avatar
0 votes
0 answers
25 views

How to use .txt file with debug50 - pset3 tideman

Does anyone know if there is a way to store a bunch of data, e.g. number of voters and votes for the Tideman problem, as a .txt file, and then run that with debug50, so that I don't have to manually ...
Joseph J Filoramo's user avatar
0 votes
0 answers
15 views

Tideman - First Error of lock_pairs function is not working

I'm currently doing the lock_pairs function of tideman. I have completed most of the requirements of check50 in the lock_pairs function except :( lock_pairs locks all pairs when no cycles. I don't ...
AlvaroAndLukeTheCoder's user avatar
0 votes
0 answers
24 views

Tideman PSET03 - Add_Pairs errors!

I'm currently doing the tideman pset and i have some errors on the add_pairs function and the lock_pais function but I'm more focused now on the add_pairs function. I don't know why these errors are ...
AlvaroAndLukeTheCoder's user avatar
0 votes
0 answers
27 views

Tideman PSET03 - Please Help Me!

I've been doing Tideman and I've completed every function required. But when I run Check50, it gives me some errors: add_pairs function did not produce 2 pairs , lock_pairs did not lock all pairs, ...
AlvaroAndLukeTheCoder's user avatar
0 votes
0 answers
33 views

Tideman - sample votes

I am very close to solving the lock_pairs function in tideman. Everything passed, except that check50 is saying that :( lock_pairs locks all pairs when no cycles isn't working correctly. But it does ...
Joseph J Filoramo's user avatar
0 votes
0 answers
9 views

Sorting an array based on ints within a strut

I'm looking for a way to implement merge sort to sort the pairs[] array in the tideman problem. The problem being the array is made up of the strut pair, not ints. However, I have added an element to ...
Gavin Colonese's user avatar
0 votes
0 answers
12 views

What is the difference between these 2 'check_cycle' functions?

This is in regard to the 'lock_pairs()' function that calls on a recursive function 'check_cycle(w, l)' function to check if a cycle will be created before locking a pair of winner (w) and loser (l). ...
str58290_03's user avatar
0 votes
0 answers
8 views

Tideman: Is there only one original winner (first sorted pair winner) that should be considered while locking subsequent pairs elements?

Seeking help if there is only one original winner to be considered while deciding if subsequent pairs to be locked or not.
Splendid Digital Solutions's user avatar
0 votes
0 answers
13 views

What is wrong in the else condition with this for loop?

Although the code below does not solve the Tideman problem making use of recursion, still it will help to know why the else condition with the for loop below does not print when pairs are not locked. ...
Splendid Digital Solutions's user avatar
0 votes
0 answers
55 views

Working on add_pairs function

While continuing working on add_pairs function (https://www.reddit.com/r/cs50/comments/123dtp8/understanding_add_pairs_function/), this is the pseudocode I have formed just to figure out if a is ...
Splendid Digital Solutions's user avatar
0 votes
0 answers
50 views

Need help in Tideman Problem set 3

My code fails to pass through below three test cases. can you please take a look at the code and suggest what is wrong. Im able to get correct answers but its not passing all test cases. :( ...
prasanna kannan's user avatar
0 votes
0 answers
18 views

Pset3 Tideman add_pair error

the check command says my add_pairs funtions doesnt count or produces the corrects pair but when I run it works fine: debug50 testing with three candidates a, b, c; preferences are in the same order ...
wnccys's user avatar
  • 1
0 votes
0 answers
71 views

Tideman - print_winner function fails to pass check50

Been scratching my head about this: I can't pass the Check50 test for my Tideman codes, under the following 2 conditions, despite that I had tried with different voting tests and the script always ...
loul7's user avatar
  • 1
1 vote
1 answer
347 views

CS50 Pset3 - Tideman - I passed all the checks except for "lock_pairs skips final pair if it creates cycle". What am I doing wrong!

I am unable to pass the above-mentioned check. I can't see the issue. I would greatly appreciate if someone can share some insights. Code is below: // Lock pairs into the candidate graph in order, ...
Lacept's user avatar
  • 11
0 votes
0 answers
60 views

pset 3 tideman - vote function - rank int

I am having trouble figuring out how to set up the rank integer in the vote function of pset3. I could do this to ask the user to rank the candidate, but I assume that wouldn't work with the sample ...
Joseph J Filoramo's user avatar
0 votes
1 answer
33 views

Invalid vote while testing Tideman problem

am working on Tideman.c problem. When I go to test the code by doing the following: -cd Tideman.c -clang tideman.c -lcs50 -./tideman Alice Bob Charlie -Number of voters: 3 -Rank 1: Alice "Invalid ...
BaaBaa's user avatar
  • 1
0 votes
1 answer
49 views

Lock pairs function not locking for final pair, but works for middle pairs

I wrote the following code: void lock_pairs(void) { for (int i = 0; i < pair_count; i ++) { bool createsLoop = false; for (int j = 0; j < pair_count; j ++) { ...
Sarmen Ter-oganesyan's user avatar
0 votes
2 answers
36 views

What to do to solve while making Tideman.c file? Each time I enter "make + Tideman.c" followed by yes, the terminal prints "y" forever

When I go to make my solution to Tideman.c for testing/debugging, I see no bugs are thrown when I go to compile the file. However, the terminal prints "y" forever once I have stated "...
BaaBaa's user avatar
  • 1
1 vote
0 answers
242 views

CS50 Tideman locked and cycle question

So i am trying to figure our something i have seen so far as some solutions for the Tideman problem from the CS50 course. My doubt is the following>> We have this code>> // Test for cycle ...
Aurelio Dzib's user avatar
0 votes
1 answer
639 views

pset3 Tideman record_preferences

Even from my view it's not the most effective solution, but I though it should work properly, however I can't really understand my mistake. Check50 says the function works incorrectly. void ...
mr_c00per's user avatar
1 vote
1 answer
430 views

Pset3 Tideman: add_pairs function

Here is my code for the add_pairs() function. I have tested it with the debugger and it seems to work fine. However, check50 tells me that it's not generating correct pair count. ''' void add_pairs(...
Soumik's user avatar
  • 15
1 vote
0 answers
541 views

Tideman test case with equal pairs

I have a feeling that I'm missing something, but have no clue what exactly... Recently I found this test case: Input: for candidates A(0), B(1), C(2) and D(3) Number of Voters: 8 A B C D A B C D B C D ...
user2225491's user avatar
0 votes
1 answer
568 views

Tideman - "lock_pairs skips final pair if it creates cycle" - Almost there!

Getting good results in test cases. Hoping someone can point out where I'm going wrong! I'm also open to general code comments. // Lock pairs into the candidate graph in order, without creating cycles ...
monkdogz's user avatar
0 votes
1 answer
37 views

pset3, vote(); direct comparison failing but strcmp() working?

Why is if (strcmp(candidates[i], name) == 0) working, but: if (name == candidates[i]) not working? I have also tried with casting string on both sides, but doesn't work. I have checked via printf, ...
Eren Turgut's user avatar
0 votes
1 answer
2k views

(Solved) Problem Set 3 - (Tideman) Print Winner Function

I have implemented everything successfully up until the 'Print Winner Function', and although I'm pretty sure my logic is correct, and doing manual tests myself yield the correct winner's name. The ...
Osama Omar's user avatar
0 votes
1 answer
525 views

PSET3 Tideman - What to do with the lock_pairs function?

Can someone please help me with the lock_pairs section of the problem? The lock_pairs function is killing me. I get that you have to compare the pairs to each other and then return false or true in ...
PrimeBeat's user avatar
  • 137
0 votes
1 answer
128 views

Passing arrays into function in tideman

I've created a solution to week 3's tideman problem which is entirely logically correct. Unfortunately, I had to dodge the standard solution by commenting out parts of a function and altering its ...
bobthebuilder's user avatar
1 vote
1 answer
389 views

pset3, tideman, cs50 2021

I worked with pset3 and I think there are nothing wrong with my code, but check 50 says it has 2 problems on my code. 1.:( lock_pairs skips final pair if it creates cycle 2.:( lock_pairs skips middle ...
Keiyeung Law's user avatar
1 vote
1 answer
408 views

Can't determine the problem with my tideman program - check50 fails at lock_pairs function, says I didn't correctly lock all non-cyclical pairs

My program for the tideman problem in pset3 passes all check50 checks except for :( lock_pairs skips final pair if it creates cycle lock_pairs did not correctly lock all non-cyclical pairs Here ...
the_midnight_developer's user avatar
1 vote
0 answers
139 views

CS50 Tideman lock_pairs function

I am now in tideman and every function seems to work fine but I've been stuck on lock_pairs. I have come up with this solution and when I try to simulate an election it seems to run fine and produces ...
Jemx's user avatar
  • 11
0 votes
1 answer
187 views

pset 3 tideman print winner does not exist despite being declared

I have such a strange behavior here in pset 3, tideman. I am doing the print_winner function because check50 says everything else is fine, but when i run the program it looks like print_winner does ...
Alejandro Sánchez's user avatar
0 votes
0 answers
262 views

Tideman error: :( lock_pairs skips final pair if it creates cycle

It would be amazing if someone had the time to look through my code for the Tideman exercise :D I get the following error: :( lock_pairs skips final pair if it creates cycle lock_pairs did not ...
nora's user avatar
  • 1
0 votes
1 answer
421 views

Sort_pairs fails check50 tideman

My sort_pairs function fails the check50 **:( sort_pairs sorts pairs of candidates by margin of victory ** test however it passes the usage case given on the CS50 website. In the pair type def, I ...
catshat 's user avatar
0 votes
1 answer
1k views

PSET 3 - Tideman: Lock Pairs Function

So basically I've got ': )' on everything except : ( lock_pairs skips final pair if it creates cycle Cause lock_pairs did not correctly lock all non-cyclical pairs : ( lock_pairs skips middle pair if ...
InfinitumGFX's user avatar
0 votes
1 answer
71 views

Pset3 Tideman: Why is my sort_pairs function not working?

I'm green on all the criteria before sort_pair. Here's my code so far: // Sort pairs in decreasing order by strength of victory void sort_pairs(void) { // TODO // Create array of strengths of ...
Ryan Ma's user avatar
1 vote
1 answer
2k views

PSET3 Tideman: Lock_Pairs Help

I've been stuck on this function of the PSET for a couple of days now. I have met every requirement in check50 except for the one that says, ":( lock_pairs skips final pair if it creates a cycle; ...
dillon__nguyen's user avatar
1 vote
1 answer
390 views

Tideman - :( lock_pairs skips final pair if it creates cycle

I have a problem in my Tideman program, it get the error ":( lock_pairs skips final pair if it creates cycle". Can anyone help me figure out what's going on? #include <cs50.h> #...
Alexander's user avatar
  • 145
1 vote
2 answers
189 views

Tideman : "sort_array" rejected by check50

I am working on Tideman today, and I am stuck on the "sort_array" function. The output my function produces is the one I expect but he 'check50' send me this ":( sort_pairs sorts pairs ...
p-lamiche's user avatar
0 votes
1 answer
911 views

Tideman: invalid operands to binary expression ('void' > and 'int')

I'm getting the following error on creating the lock-pair function: tideman.c:259:36: error: invalid operands to binary expression ('void' and 'int') if (check_winner(pairs[i]) == -1) Can someone ...
Alexander's user avatar
  • 145
1 vote
1 answer
87 views

Segmentation fault tideman swap function

I'm getting segmentation fault due to my swap function I believe - but can't figure out where it comes from. #include <cs50.h> #include <stdio.h> #include <string.h> // Max number ...
Alexander's user avatar
  • 145
0 votes
1 answer
601 views

pset3 tideman lock_pairs: why does "lock_pairs locks all pairs when no cycles" fail?

My code fails at check50 but I can't understand why. It that seems my code actually finds cycles, but also produces false-positives (I guess). check50 output for the lock_pairs function: :( lock_pairs ...
NoNickAvailable's user avatar
0 votes
1 answer
162 views

pset3 tideman cs502020 locked pairs error

I am new to coding and I am trying to solve the locked pairs part of the Tideman problem. Currently, I am receiving the following two errors: :) lock_pairs locks all pairs when no cycles :( lock_pairs ...
Clueless's user avatar
0 votes
1 answer
74 views

Tideman sort_pairs seems correct but check50 tells me it isn't

Here is the code for my pair sorting algorithm. void sort_pairs(void) { int sorted_pairs_added = 0; for (int i = voter_count; i > 0; i += -1) { for (int j = 0; j < pair_count;...
Flose's user avatar
  • 1
0 votes
1 answer
86 views

Converting Tideman Cycle test from Python to C

I have written a program in python that (as far as I know) successfully determines whether the locked matrix has a loop in it. However I am having a bit of trouble converting it to C. I am getting an ...
Flose's user avatar
  • 1
0 votes
1 answer
8k views

How to swap elements in "struct" data type?

I am working on "tideman" from pset3 and stuck on sorting the data that i have in "struct" data type. Don't really know if it was supposed to be figured out on our own, but they ...
Sayyed Gauss's user avatar
2 votes
1 answer
1k views

lock_pairs skips final pair if it creates cycle lock_pairs did not correctly lock all non-cyclical pairs

can anyone please help I got only one error which is:- lock_pairs skips final pair if it creates cycle lock_pairs did not correctly lock all non-cyclical pairs and this is my code bool hash_cycle(int ...
Aman Singh's user avatar