# Questions tagged [tideman]

The tag has no usage guidance.

70 questions
Filter by
Sorted by
Tagged with
0answers
9 views

### Tideman lock_pairs function

I'm working on the lock_pairs function, and what I do is creating another function called "cycle" to check whether each pair is going to create the cycle. If it will create the cycle, this &...
0answers
29 views

### Okay, legit think that check50 on Tideman is broken

Actually not, still I cannot grasp what is wrong with the lock_pairs function in my code. This is my lock_pairs function: // Loop to pass each pair for (int i = 0; i < pair_count; i++) { ...
1answer
45 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 ...
0answers
27 views

### Need a bit of help in lock_pairs function of tidema(Pset3)

Here's my code for lock pairs- bool check_cycle(int start, int end) { if (end == start) { return false; } for (int i = 0; i < candidate_count; i++) { if (locked[...
1answer
40 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 ...
1answer
59 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 ...
2answers
66 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 ...
0answers
36 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 ...
1answer
48 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 ...
0answers
76 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 ...
1answer
33 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 ...
1answer
131 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 ...
1answer
35 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 ...
1answer
36 views

### CS50 Tideman : Sort Pairs problem - check50 automatic test fails, but output seems correct

Good morning guys, I am working on implementation of tideman. Particulary at implementing sort_pairs function. I have written it and tested - and the output seems sorted in a proper way. However - ...
1answer
278 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; ...
1answer
143 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> #...
2answers
52 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 ...
1answer
96 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 ...
1answer
37 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 ...
1answer
129 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 ...
0answers
40 views

### PSET3 Tideman Sorting Check50 Error

What's the difference between these two codes? Why does the first return me no error from check50 while the second one does? void sort_pairs(void) { int max; for (int i = 0; i < pair_count; ...
1answer
70 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 ...
0answers
35 views

### cs50 pset3 print winner function

Im strugling with print_winner function in Tideman election program. In my opinion function workes fine. It prints the candidate which has all false values in column under his name (number) in locked ...
1answer
39 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;...
1answer
24 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 ...
0answers
49 views

### help with pset3 tideman lock_pairs function

This function is a recursive function, that lock_pairs is using to understand if a pair will create a cycle: bool create_cycle(int win_idx, int orig_idx) { if (win_idx == orig_idx) // if it's not ...
0answers
35 views

### PSET3 Tideman: Help with lock_pairs function

how's it going? I'm now working on Tideman but I'm now having a hard time why my code does not satisfy all the condition, only the first one: :) lock_pairs locks all pairs when no cycles These two ...
0answers
94 views

### I'm STUCK for a good while in pset3 Tideman last 3 functions :(

I'm mostly concerned about the sort_pairs() function atm, but i'm willing to receive answers regarding the whole code. I can't really see what's wrong with the way i coded it in general, but mostly ...
0answers
33 views

### tideman sort pairs not working

dont know why my function isn't working, i suspect the while loop triggers even when it shouldn't. void sort_pairs(void) { // TODO supair supairs[pair_count]; supair unSorted[pair_count]; ...
1answer
2k 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 ...
0answers
54 views

### CS50 tideman Lockpairs function (Doesn't skip the last pair?)

So in order to solve lockpairs function, I made a custom function that can detect a cycle (it would return true if it has a cycle, false if it doesn't). My custom functions logic is: Check each pair ...
0answers
45 views

### Could someone explain why this function for pset3/tideman isn't correct

So as seems to be the case with many people, I'm struggling a bit with tideman. My code scores full marks up until the point where the pairs become "locked." The code for my lock_pairs ...
0answers
22 views

### Tideman: linking pairs to candidates

and thanks for helping. I am confused with Tideman, and would love some enlightenment: I successfully sorted pairs, and can't figure out, in order to fill the bool locked, how to link the candidates ...
0answers
63 views

### lock_pairs skips final pair if it creates cycle

I have been working on the tideman problem from Problem Set 3. After multiple attempts, I have been able to pass all the required checks except one: "lock_pairs skips final pair if it creates ...
0answers
49 views

### Problem Set 3 - Tideman Lock Pairs

I am trying to solve the tideman problem for pset3. I have managed to get all parts of my code working apart from the the two parts which relate to checking whether cycles are created. :( lock_pairs ...
0answers
43 views

### Error in recursive cycle check function for pset3 tideman

I've implemented a recursive function to check for cycles and return a boolean based on if a cycle is found or not. Check50 only returns one error, and that is for "lock_pairs skips final pair if ...
0answers
39 views

### PSET 3 TIDEMAN Locked pairs Function

I am relatively new to the community so please forgive me should my question not be coherent enough. Ok so basically check 50 tells me that everything in my code is okay except for the locked pairs ...
1answer
680 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 ...
0answers
30 views

### Lock pairs and Recursivity

I've been trying to solve this pset since more than a month and don't want to give up... so this is the first time I'm coming to ask for help. Basically I separated in two parts the lock_pairs ...
0answers
165 views

### Can't get pset3/tideman's lock-pairs function to work

Before going to Python I thought I'd go back to some previous homework that I hadn't been able to solve - pset3/tideman. I've spent ages on this but I just can't seem to figure out the lock function. ...
1answer
175 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 ...
1answer
120 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 ...
1answer
409 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 // ...
1answer
361 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 ...
1answer
52 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; ...
1answer
496 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] = ...
1answer
103 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++) ...
0answers
249 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 ...
1answer
25 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 ...
1answer
55 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. ...