- CS50 - 2017 - Problem Sets
This is a work in progress repository containing solutions for CS50 problem sets.
I mainly use this as personal training grounds to try out different things and learn while doing it.
Feel free to contribute in any way you see fit, all feedback is welcome.
Latest CS50 Library for C.
How to install (Might be outdated)
As per specifications make a program in scratch:
My implementation of a simple game.
A program that prints out a simple greeting to the user:
./hello
Hello, world!
Official specifications for hello on CS50.
My implementation of hello.
A program that reports a user’s water usage, converting minutes spent in the shower to bottles of drinking water:
./water
Minutes: 1
Bottles: 12
./water
Minutes: 10
Bottles: 120
Official specifications for water on CS50.
My implementation of water.
A program that prints out a half-pyramid of a specified height:
./mario
Height: 5
##
###
####
#####
######
./mario
Height: 3
##
###
####
Official specifications for mario on CS50.
My implementation of mario.
A program that prints out a double half-pyramid of a specified height:
./mario
Height: 4
# #
## ##
### ###
#### ####
Official specifications for mario on CS50.
My implementation of mario.
A program that calculates the minimum number of coins required to give a user change:
./greedy
O hai! How much change is owed?
0.41
4
Official specifications for greedy on CS50.
My implementation of greedy.
A program that determines whether a provided credit card number is valid according to Luhn’s algorithm:
./credit
Number: 378282246310005
AMEX
Official specifications for credit on CS50.
My implementation of credit.
A program that, given a person’s name, prints a person’s initials:
./initials
Regulus Arcturus Black
RAB
Official specifications for initials on CS50.
My implementation of initials.
A program that, given a person’s name, prints a person’s initials, while ignoring additional whitespace:
./initials
Regulus Arcturus Black
RAB
Official specifications for initials on CS50.
My implementation of initials.
A program that encrypts messages using Caesar’s cipher:
./caesar 13
plaintext: HELLO
ciphertext: URYYB
Official specifications for caesar on CS50.
My implementation of caesar.
A program that encrypts messages using Vigenère’s cipher:
./vigenere ABC
plaintext: HELLO
ciphertext: HFNLP
Official specifications for vigenere on CS50.
My implementation of vigenere.
A program that cracks passwords:
./crack 50fkUxYHbnXGw
rofl
Official specifications for crack on CS50.
My implementation of crack.
A program that finds a number among numbers:
./generate 1000 | ./find 42
Didn't find needle in haystack.
Official specifications for find on CS50.
My implementation of find.
A program that finds a number among numbers:
./generate 1000 | ./find 42
Didn't find needle in haystack.
Official specifications for find on CS50.
My implementation of find.
Game of Fifteen:
./fifteen 3
WELCOME TO GAME OF FIFTEEN
8 7 6
5 4 3
2 1 _
Tile to move:
Official specifications for game of fifteen on CS50.
My implementation of fifteen.
A program that reveals a reveals a hidden message in a BMP:
./whodunit clue.bmp verdict.bmp
Official specifications for whodunit on CS50.
My implementation of whodunit.
Implement a program that resizes BMPs:
./resize 4 small.bmp large.bmp
Official specifications for Resize on CS50.
My implementation of Resize.
Implement a program that resizes BMPs:
./resize 4 small.bmp large.bmp
./resize .25 large.bmp small.bmp
Official specifications for Resize on CS50.
My implementation of Resize.
Implement a program that recovers JPEGs from a forensic image:
./recover card.raw
Official specifications for Recover on CS50.
My implementation of Recover.
Implement a program that spell-checks a file:
./speller texts/austinpowers.txt
MISSPELLED WORDS
[...]
Bigglesworth
[...]
Virtucon
[...]
friggin
[...]
trippy
[...]
WORDS MISSPELLED:
WORDS IN DICTIONARY:
WORDS IN TEXT:
TIME IN load:
TIME IN check:
TIME IN size:
TIME IN unload:
TIME IN TOTAL:
Official specifications for Speller on CS50.
My old implementation of Speller. My trie implementation of Speller.
Port some previous programs from C to Python.
Official specifications for Problem Set 6
My implementation of Mario, less comfortable on python.
My implementation of Mario, more comfortable on python.
My implementation of Greedy on python.
My implementation of Credit on python.
My implementation of Caesar on python.
My implementation of Vigenere on python.
My implementation of Crack on python.
Official specifications for Sentiments
-
Implement a program that categorizes a word as positive or negative.
./smile love :) ./smile hate :( ./smile Stanford :|
My implementation of smile and analyzer
-
Implement a program that categorizes a user’s tweets as positive or negative.
./tweets @cs50 0 hello, @world 1 I love you, @world -1 I hate you, @world
My implementation of tweets and analyzer
-
Implement a website that generates a pie chart categorizing a user’s tweets.
My implementation of application and helpers
Implement a website via which users can "buy" and "sell" stocks.
Official specifications for finance on CS50.
My implementation of finance and online website.
Implement a website that lets users search for articles atop a map.
Official specifications for mashup on CS50.
My implementation of mashup and online website.