Welcome to my GitHub repository for the C and C++ Programming Specialization offered by the University of California, Irvine on Coursera. In this repository, you'll find my completed assignments, projects and some sparse notes.
I embarked on this journey to delve deeper into the world of programming and broaden my skills beyond Python. C and C++ offer powerful tools and insights that complement my existing knowledge, making me a more versatile programmer. Moreover, learning new concepts and languages is not just a pursuit of knowledge but also an enjoyable challenge that I embrace with enthusiasm.
The C and C++ Programming Specialization provided a comprehensive introduction to these languages, covering fundamental concepts, data structures, algorithms, and best practices. Through a series of hands-on projects and assignments, I gained practical experience and honed my problem-solving skills.
The end of the course focussed on Graph theory and AI which I learned much about.
- Fundamentals: Here you will find my solutions to the assignments of the first course in the series, fundamentals.
- StructuredProgramming : Here you will find my solutions to the assignments of the second course in the series, structured programming.
- Cpp4cdev: Here you will find my solutions and notes of the third and fourth course in the series.
Feel free to explore the contents of this repository and learn alongside me. If you have any questions, suggestions, or feedback, don't hesitate to reach out. Let's continue learning and growing together!
Happy coding!
The fundamentals folder contains the material and solutions for couse one. It covered the very basics and some core concepts of the c language.
Here you'll find the assignment for Week 1. This weeks lectures covered:
- Simple input/output operations using
printf
andscanf
. - Basics of compiling C programs.
- Introduction to debugging C code.
Here you'll find the assignment for Week 2. This weeks lectures covered:
- Introduction to keywords and identifiers in C programming.
- Understanding fundamental operations and operators in C, including arithmetic, relational, logical, and bitwise operators.
- Exploring expressions and their role in C programming.
- Understanding the
sizeof
operator and its role in determining the size of data types. - Exploring the
int
data type and its usage in C programming. - Introduction to the
float
data type and its usage for representing floating-point numbers.
Here you'll find the assignment for Week 3. This weeks lectures covered:
- Practice with input/output operations, reinforcing concepts from Week 2.
- Further exploration of keywords, identifiers, expressions, and the
sizeof
operator. - Introduction to the switch statement and its usage for multi-way branching in C programming.
- Understanding the comma operator and its role in sequence expressions.
Here you'll find the assignment for Week 4. This weeks lectures covered:
- Introduction to functions, including their definition and usage in C programming.
- Understanding function prototypes and their importance in declaring functions before their use.
- Exploring the concept of recursion and its application in solving problems.
- Understanding scope rules in C programming, including local, global, and block scope.
- Differentiating between call by value and call by reference in function parameter passing.
Here you'll find the assignment for Week 5. This weeks lectures covered:
- Exploration of pointers, covering their syntax, usage, and memory management.
- Understanding the concept of arrays, including their declaration, initialization, and manipulation.
- Comprehensive coverage of call by reference, examining its implementation and advantages over call by value.
Welcome to the Structured Programming section, the second part of the course where we delve deeper into the C language.
Here you'll find the materials and assignments for Week 1, covering:
- Introduction to enums (enumerated types) in C programming.
- Understanding preprocessor directives, including #define, #include, and #ifdef.
- Exploring the assert() statement for debugging and error handling.
In Week 2, we explored the concept of structs and their implementation in C programming. Structs allow us to create custom data types by grouping together related variables, providing a convenient way to organize and manipulate data.
We also delved into the fundamental concept of stacks and how to implement them using structs. Stacks are abstract data types that follow the Last In, First Out (LIFO) principle, making them suitable for various applications such as expression evaluation, function call management, and more.
- Introduction to structs and their syntax in C programming.
- Understanding how structs allow us to define custom data types.
- Exploring practical examples of struct usage, including defining employee records, cards in a deck, and more.
- Understanding the stack data structure and its operations: push, pop, and isEmpty.
- Hands-on practice with implementing a stack using structs in C.
- Real-world applications of stacks and their significance in computer science.
In Week 3, we explored linked lists and their manipulation, along with an introduction to binary search trees (BSTs) and their properties. Here's what we covered:
- Introduction to singly linked lists and their implementation in C.
- Working with linked list nodes and pointers.
- Creating, traversing, and printing linked lists.
- Operations on linked lists, such as insertion, deletion, and searching.
- Understanding binary search trees (BSTs) and their properties.
- Implementing BSTs in C and performing common operations such as insertion, deletion, and traversal.
In Week 4, we focused on two important topics: File I/O and working with command line arguments (argc
and argv
). Here's what we covered:
- Introduction to File I/O operations in C programming.
- Reading data from files using
fopen()
,fscanf()
, andfclose()
functions. - Writing data to files using
fprintf()
andfwrite()
functions. - Handling file errors and checking for file existence.
- Understanding the
argc
(argument count) andargv
(argument vector) parameters in themain()
function. - Parsing command line arguments and using them to control program behavior.
- Practical examples of command line argument usage in C programs.
- Implementation of basic arithmetic operations on rational numbers (addition, subtraction, multiplication, division).
- Reading rational numbers from a file and performing arithmetic operations.
- Creating and traversing a binary tree structure from integer pairs read from a file.
In this section, I'll summarize the third and fourth parts of the course, which focus on transitioning from C to C++, leveraging object-oriented programming (OOP) concepts, and exploring the advancements and improvements offered by C++ over C. Let's dive into the details:
In Week 1, we delved into the following key topics:
- Introduction to Object-Oriented Programming (OOP) concepts.
- Conversion of C code to C++.
- Highlighting the significant differences and improvements of C++ over C.
In Week 2, we explored the following topics:
- Introduction to classes in C++ including constructors and destructors.
- Understanding the concept of operator overloading and its implementation in C++.
- Exploring the concept of generic functions and their usage in C++ programming.
- Learning about enums in C++ and how they provide a way to define a set of named integral constants representing enumerators.
- An introductory session on graph theory, its significance, and basic concepts.
In Week 3 we explored the following topics:
- Deep-dive into classes in C++
- Exploring graph theory and dijkstra algorithm
- Introduction to priority queues
- Homework which combined all the concepts above
In Week 4 we explored the following topics:
- Minimal Spanning Tree Algorithms
- Overloading Functions and understanding how the compiler decides which code to run
- Intro to STL
- STL Containers
- STL Iterators
- STL Algorithms
Only the exam was done in this week
- Exam
Week 6 started course B of the last leg of the Course. This week covered:
- Deeper dive into the STL
- Deep dive into container types
- Deep dive into iterator types and their differences
- Deep dive into algorithms
- Introduction to Lambda expressions/functions
In Week 7, we focused on the game of Hex and its implementation using graph theory. Here's what we covered:
- We implemented the game of Hex, a two-player strategy board game.
- The game involved creating a hexagonal grid and allowing players to place their stones on the grid.
- The objective of the game was to create a connected path of stones from one side of the board to the opposite side.
- We utilized graph theory concepts to represent the game board and the connections between the stones.
- Graph theory allowed us to efficiently determine the winning condition and check for connected paths.
- We implemented a smart AI opponent for the game of Hex.
- The AI opponent utilized various strategies and algorithms to make intelligent moves and compete against human players.
- We used Monte Carlo simulation to generate a smart AI agent for the game of Hex.
- Monte Carlo simulation involved running multiple random simulations of the game to determine the best move in a given situation.
Overall, Week 7 provided an exciting opportunity to apply graph theory, implement the game of Hex, and create intelligent AI opponents using various strategies and algorithms.