Skip to main content

Questions tagged [tideman]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
11 views

CS50 Tideman : sort_pairs

sort_pairs is not returning successfully when I check the code. Can anyone help point me in the right direction? I spent quite a while on the previous functions getting them correct as I've been away ...
Blue_Angel's user avatar
0 votes
1 answer
13 views

tideman cs50 - add_pairs

recently I've been stuck on problem set 3's Tideman, so I went online to search for some enlightenment and I found a simple fix. My original code was using preferences[i][j] > voter_count / 2.0 , ...
Edward's user avatar
  • 3
1 vote
1 answer
21 views

pset 3 Tideman - vote function works differently using check50 than manual testing

My code for the vote function is as follows: bool vote(int rank, string name, int ranks[]) { // TODO for (int i = 0; i < candidate_count; i++) { if (strcmp(candidates[i], name) =...
Oscar Harding's user avatar
0 votes
1 answer
12 views

Output the overall ranking of votes

I am trying to output the overall ranking of votes for each candidate with the vote function as bool vote(int rank, string name, int ranks[]) { // TODO for (int i = 0; i < ...
Mestica's user avatar
  • 101
1 vote
0 answers
27 views

Tideman: Is my thinking correct for sort_pairs and lock_pairs?

I have just finished tideman and passed all checks on check50. However, I wanted to check if my thinking for my code is on the right track, or I got here just by luck. Firstly, for sort pairs, this is ...
Seanie's user avatar
  • 11
1 vote
1 answer
56 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
34 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
1 vote
1 answer
414 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
71 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
43 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
64 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
39 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
255 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
730 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
466 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
608 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
586 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
43 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
579 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
144 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
392 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
423 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
141 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
192 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
270 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
449 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
76 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
395 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
196 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
933 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
88 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
623 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
165 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
79 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
  • 101
0 votes
1 answer
91 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
  • 101
0 votes
1 answer
9k 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
0 votes
1 answer
487 views

pset3 Tideman: checking for cycles

I made it so that if a losing candidate in any pair wins in another, a function checks whether there's the losing candidate in that pair wins in any other, and so forth. this here is the unlocks the ...
Akram Bouaziz's user avatar
1 vote
1 answer
285 views

My print_winner from pset3/tideman is doing everything right and still check50 says it's wrong

void print_winner(void) { bool looser; for (int i = 0; i < pair_count; i++) { looser = false; for (int j = 0; j < pair_count; j++) //checks if each winner ever lost ...
Sajeeb's user avatar
  • 11
0 votes
1 answer
494 views

Pset 3 Tideman lock pairs function

Help, i'm losing my mind. I'm not sure where i'm going wrong in this function, it gives me an error on every line of check50 after sort pairs. Can anybody shed any light? Thank you in advance! J // ...
Jamie Walker's user avatar
1 vote
1 answer
799 views

Logical flaw in Problem Set 3 - Tideman?

Whilst writing my code for Tideman in Problem Set 3, I had many problems with the lock pair function, as I am very new to coding. Some research I did online also showed that this question is ...
Ethan Mark's user avatar
0 votes
1 answer
85 views

sort_pairs function not working as per check50

This seems to be a common problem where the check50 program indicates a problem with the sort_pairs function. Here was my implementation of that function: int w; int l; int w1; int l1; for (int i=0; ...
Arvind R's user avatar
0 votes
1 answer
620 views

Please help about tideman lock_pair function!

// Lock pairs into the candidate graph in order, without creating cycles void lock_pairs(void) { for (int i = 0; i < pair_count; i++) { locked[pairs[i].winner][pairs[i].loser] = ...
Duncan Wan's user avatar
0 votes
1 answer
158 views

Program and debug50 different results

I'm trying to do pset3/tideman. My question is, why when I run program, I get different result (matrix[m]) than run with debug50? void lock_pairs(void) { for (int i = 0; i < pair_count; i++) ...
hatchet's user avatar
1 vote
0 answers
414 views

Pset3 Tideman: lock_pairs skips middle pair if it creates a cycle

I'm having issues figuring out how to solve this problem without using recursion (I'm not sure how to solve things recursively). Its a program that determines the winner of a Tideman election and I'm ...
timmy a's user avatar
  • 11
0 votes
1 answer
45 views

What's in the bool function parenthesis?

hope everyone is staying safe. I just want to understand what's inside the parenthesis of the vote function in pset3 - Tideman: bool vote(int rank, string name, int ranks[]) What does it mean to ...
ZeevKeane's user avatar
0 votes
1 answer
87 views

p_set3 why does the int main clear the graph of locked in pairs?

hope everyone is staying safe. I am in week 3 and doing problem set # 3 - Tideman voting. In the main function it says the following: Why does it need to clear the graph of locked in pairs? (p.s. ...
ZeevKeane's user avatar