# Tag Info

## Hot answers tagged algorithm

Accepted

### What's the most efficient prime-finding algorithm? (Week 1 Practice Problems)

You can likely google it to find out. But the first thing that comes to mind is to lower the high limit of numbers to check. Simply put, if you're checking whether N is a prime, you need only see if ...
• 69k
Accepted

### Can anyone explain that attendence algoritm of week 0 lecture?

Following would be the steps assuming 8 students are in the room 1. Each of them would have the number 1 in their mind and 8 of them would be standing 2. You add the number in your pair's mind (in ...
• 36
1 vote
Accepted

### PS2 Caesar Algorithm

The only time this if (ptxt[i] >= 'Z' && isupper(ptxt[i])) will evaluate to true is when ptxt[i] is 'Z'. There is no other (upper case) letter that can be both. (Similarly this else if (...
• 28.5k
1 vote

### Why are algorithms mentioned in week 2

Bigger picture: In programming, there are certain tasks that appear over and over in some form or another. Sorting data is one of them. Linked lists are another. These tasks have been analyzed ...
• 69k
1 vote
Accepted

### Iterative vs Recursive

In the problems that you will find in cs50, you will not find any difference in speed especially in C, as you well say the recursive solution requires more memory usage. We simply use a recursive ...
• 5,169
1 vote

### pset 1 credit.c invalid cards are valid by cs50

What about this 5105105105105100? 1*2 + 5*2 + 0*2 + 1*2 + 5*2 + 0*2 + 1*2 + 0*2 2 + 10 + 0 + 2 + 10 + 0 + 2 + 0 2 + 1 + 0 + 2 + 1 + 0 + 0 + 2 + 0 = 8 8 + 5 + 0 + 1 + 5 + 0 + 1 + 5 + 0 = 25 The ...
1 vote
Accepted

### pset 1 credit.c invalid cards are valid by cs50

371449635398431 is a valid AMEX card. From this post: 3 7 1 4 4 9 6 3 5 3 9 8 4 3 1 Okay, letâ€™s multiply each of the underlined bold digits by 2 7*2 + 4*2 + 9*2 + 3*2 + 3*2 + 8*2 + 3*...
• 28.5k
1 vote

### pset 1 credit.c invalid cards are valid by cs50

Where you got 107, I did the maths without calculator, and got to 90. Keep in mind that the digits to double start with the second to last digit (so first digit could be regular or doubled), and that ...
• 21k

Only top scored, non community-wiki answers of a minimum length are eligible