Skip to content
This repository has been archived by the owner on Oct 19, 2019. It is now read-only.

azdanov/CS50

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CS50 - 2017 - Problem Sets

CS50

Table of Content

Intro

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.

Dependencies

Latest CS50 Library for C.

How to install (Might be outdated)

Problem Set 0

Scratch

As per specifications make a program in scratch:

Scratch

My implementation of a simple game.

Problem Set 1

Hello

A program that prints out a simple greeting to the user:

./hello

Hello, world!

Official specifications for hello on CS50.

My implementation of hello.

Water

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.

Mario, less comfortable

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.

Mario, more comfortable

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.

Greedy, less comfortable

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.

Credit, more comfortable

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.

Problem Set 2

Initials, less comfortable

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.

Initials, more comfortable

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.

Caesar, less comfortable

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.

Vigenere, less comfortable

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.

Crack, more comfortable

A program that cracks passwords:

./crack 50fkUxYHbnXGw

rofl

Official specifications for crack on CS50.

My implementation of crack.

Problem Set 3

Find, less comfortable

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.

Find, more comfortable

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

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.

Problem Set 4

Whodunit

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.

Resize, less comfortable

Implement a program that resizes BMPs:

./resize 4 small.bmp large.bmp

Official specifications for Resize on CS50.

My implementation of Resize.

Resize, more comfortable

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.

Recover

Implement a program that recovers JPEGs from a forensic image:

./recover card.raw

Official specifications for Recover on CS50.

My implementation of Recover.

Problem Set 5

Speller

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.

Problem Set 6

Port some previous programs from C to Python.

Official specifications for Problem Set 6

Mario python

My implementation of Mario, less comfortable on python.

My implementation of Mario, more comfortable on python.

Greedy, less comfortable python

My implementation of Greedy on python.

Credit, more comfortable python

My implementation of Credit on python.

Caesar, less comfortable python

My implementation of Caesar on python.

Vigenere, less comfortable python

My implementation of Vigenere on python.

Crack, more comfortable python

My implementation of Crack on python.

Sentiments

Official specifications for Sentiments

  1. Implement a program that categorizes a word as positive or negative.

    ./smile love
    
    :)
    
    ./smile hate
    
    :(
    
    ./smile Stanford
    
    :|
    

    My implementation of smile and analyzer


  2. 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


  3. Implement a website that generates a pie chart categorizing a user’s tweets.

    Tweet pie

    My implementation of application and helpers

Problem Set 7

Finance

Implement a website via which users can "buy" and "sell" stocks.

Official specifications for finance on CS50.

Finance

My implementation of finance and online website.

Problem Set 8

Mashup

Implement a website that lets users search for articles atop a map.

Official specifications for mashup on CS50.

Mashup

My implementation of mashup and online website.

License

MIT