Apr
10
awarded Popular Question
2018
May
30
awarded Popular Question
2016
Sep
22
comment UnionFind data structure implemented in Python
@vnp Thanks! The rewrite of find is much better.
Sep
22
comment UnionFind data structure implemented in Python
@MathiasEttinger Thanks for the suggestion. It is a lot more natural to not have to call find with an argument
Sep
22
comment FindUnion data structure used to find the minimum cut of a graph
@Sumurai8 Haven't seen that one before but it was pretty great!
Sep
22
asked FindUnion data structure used to find the minimum cut of a graph
Sep
22
asked Is it faster to add a key to a dictionary or append a value to a list in Python?
Sep
22
asked UnionFind data structure implemented in Python
Sep
21
comment Why is my list not getting reset on every loop in Python
Thanks for the suggestion. I ended up using a tuple of tuples. It allowed me to make a copy by casting it as a list of tuples and then swapping out the tuples when I needed too. Ultimately though I picked a very poor data structure that made the code run extremely slow (far to slow for practical purposes) so I am switching to a Union Find data structure.
Sep
20
awarded Commentator
Sep
20
accepted Why is my list not getting reset on every loop in Python
Sep
20
comment Why is my list not getting reset on every loop in Python
Thanks for explaining the issue of using tuple like this. I assumed that anything in a tuple couldn't be changed but I now see what you mean and it makes perfect sense. I really don't want to use deep copy because there will be another loop containing the above for loop that goes through about 1 000 000 iterations. Do you think it would be reasonable to loop over my tuple and make all the sublists tuples too? or is there a better way to do this at the start once?
Sep
20
comment Why is my list not getting reset on every loop in Python
@PaulRooney I am confused about how this affect my problem. My understanding of scope is it causes issues when getting values from a for loop but this is all being done in the loop and trialEdges is getting "reset" overtime directly before the print statement
Sep
20
asked Why is my list not getting reset on every loop in Python
Sep
17
comment How to use a function to change a list when passed by reference?
That definitely helps clear things up. Thanks again for the help
Sep
17
comment How to use a function to change a list when passed by reference?
Thanks! The info about the slice operation is exactly what I was looking for!
Sep
17
comment How to use a function to change a list when passed by reference?
Thank you! This is exactly what I was looking for. I started to suspect my list passing was creating copies instead of only operating on the sublist but still in place.
Sep
17
accepted How to use a function to change a list when passed by reference?
Sep
17
comment How to use a function to change a list when passed by reference?
@Carcigenicate is it possible your thinking of xrange in python 2.x. xrange generates an xrange object that generates values when the index is requested. This saves a lot of memory space. In python 3.x xrange was renamed range. In python 2.x range returns a list. I think the problem is with the recursive calls to sublists. There must be a copy generated when you don't pass the entire list to the next function
Sep
17
revised How to use a function to change a list when passed by reference?
added 129 characters in body
1 2 3