r/AskComputerScience • • Nov 07 '24

Making a 4 bit subtractor from a 4 bit adder

3 Upvotes

Hey guys, I'm using Logisim to create a 16 bit cpu and right now I'm making a 4 bit adder/subtractor. I've followed this picture but a problem I'm getting is that the carry is 1 for values that it should not be 1 for, like when both inputs are 0. How should I fix this?


r/AskComputerScience • • Nov 06 '24

How did you guys get so good at algorithms?

17 Upvotes

I really don't get how some people can just pick up algorithms like it's nothing

I'm in this algorithms and design class and its absolutely fucking me up. Trying to come up with recurrence relations, find out amortized costs using potential functions, and then needing to come up with a proof for everything too...

I can understand the algorithms like Knapsack and Bellman-Ford etc. when they're explained to me, but when it comes to deriving something original using these algorithms as a base, I'm just completely lost. Looking at our posted solutions to said problems as well just adds to my confusion. Maybe I just need more practice, but it just feels so damn defeating to constantly be losing at this

If anyone out there is nutty with algorithms and proofs, how did you guys get so good? How do you think? Are there any good resources out there for this ?

Sorry if this kind of post isn't welcome here, I just wanted to let out little bit of steam