Skip to content

CS50x Week 5 solutions with detailed explanations. Includes genetic inheritance simulation (inheritance.c), and a spell checker using hash tables (speller.c). Each program features in-depth descriptions and key insights for enhanced understanding.

License

Notifications You must be signed in to change notification settings

InfectedDuck/CS50x-Week5-Solution-With-Deep-Explanation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

⭐️ Star this repository! It really motivates me to make better explanations and produce more work!! ⭐️

Overview

This repository contains several C programs that implement different functionalities and algorithms:

  1. inheritance.c - A program that simulates genetic inheritance of blood types.
  2. speller.c - A program that implements a spell checker using a hash table.
  3. dictionary.c - A program that provides dictionary functionalities using a hash table.

Description

1. inheritance.c

Purpose

The inheritance.c program simulates the inheritance of blood types through multiple generations. It constructs a family tree and assigns blood type alleles randomly.

How it Works

  1. Creates a family tree with a specified number of generations.
  2. Randomly assigns blood type alleles to individuals.
  3. Prints the family tree with the assigned blood types.

Key Points

  • Simulates genetic inheritance using random allele assignment.
  • Constructs and displays a family tree structure.
  • Utilizes basic data structures and random number generation.

2. speller.c

Purpose

The speller.c program implements a spell checker that uses a hash table to check if words are correctly spelled based on a dictionary. It also benchmarks various operations.

How it Works

  1. Loads a dictionary into memory using a hash table.
  2. Reads and checks each word in the input text file.
  3. Reports misspelled words and provides benchmarking results.

Key Points

  • Utilizes hash table for efficient word checking.
  • Benchmarks dictionary loading, word checking, and unloading.
  • Handles file input/output and memory management.

3. dictionary.c

Purpose

The dictionary.c program implements basic dictionary functionalities using a hash table. It includes operations to load, check, size, and unload a dictionary.

How it Works

  1. Loads words from a dictionary file into a hash table.
  2. Provides functionality to check if words are in the dictionary.
  3. Calculates the number of words and unloads the dictionary from memory.

Key Points

  • Implements hash table for dictionary operations.
  • Handles file reading and memory management.
  • Provides essential dictionary functionalities.

Credits

CS50 Logo

Credits to CS50x

This project was inspired by and developed as part of the CS50x course offered by Harvard University. CS50x is Harvard University's introduction to the intellectual enterprises of computer science and the art of programming for majors and non-majors alike, with or without prior programming experience.

  • Course: CS50x: Introduction to Computer Science
  • Institution: Harvard University
  • Instructor: David J. Malan
  • Website: CS50x Official Site

Thank you to the CS50x team for providing such a comprehensive and engaging introduction to computer science.

About

CS50x Week 5 solutions with detailed explanations. Includes genetic inheritance simulation (inheritance.c), and a spell checker using hash tables (speller.c). Each program features in-depth descriptions and key insights for enhanced understanding.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published