The culmination of C knowledge is gathered in resolving this problem. The problem is “Speller” and you have to implement a hash function in C that helps you populate a database. You have to have really good knowledge of pointers, you have to know how to allocate and de-allocate memory, you have to understand exactly how linked lists work in C and you have to figure out ( or find on the internet) a good Hash function.
January 2020 – Problem set 5 – Creating an app which checks grammatical errors
I have gained that by watching a lot of extra Youtube Videos and also watching numerous times the accompanying lectures. In Python, pointers do not exist so it was a very strange new concept. But if you do not understand pointers you can’t understand a linked list, nor a binary tree or other data structures. If you can’t understand these structures then you can’t get hired at a really cool company ( it seems to me as a beginner that every company will ask you algorithmic questions and implementations)
Reading around about getting hired as a programmer, I noticed that most companies like Google, Facebook etc ask algorithmic questions and implementations on job interviews. So understanding these structures at a higher level seem to be, pretty often, a key point for a dream job.
There is even a contest – with no prize actually – in which the best hash functions are presented in a table on the official site. When I finished this problem I felt really confident and I started to breathe more easily, but not for long !!
December 2019 Problem set 3 – Replace some pixels from a bitmap to see a message
I am writing this after it happened. There is a problem in which you have to filter out from a bitmap some red pixels so you can see a hidden text. I never did this problem because in the new year the Pset ( Problem Set) changed- but that is not the real motive.
The real motive is that I got discouraged because of what I perceived as an unapproachable complexity: headers, structs, custom types, etc. It felt like I was staring at the tip of the mountain and didn’t know which way to take. I tried googling it, learning, searching and nothing. The plethora of errors was adding up to the frustration (SISEGV, pointer errors, syntax errors, insufficiently knowing structures and datatypes in C.
Then I said to myself – enough with these breadcrumbs of information! I need to study C comprehensively or else I will never finish this introductory course.
Then, in the 16 days trip to NY ( antrepreneurial holiday !:P) I didn’t have much time to study. After I restarted in January 2020 I found the next chapters easy in comparison with Mario. They were easy because I understood what and how they should be done. Not knowing the syntax, a problem like Mario in Problem set 1 was Extremely Hard, even though in Python I would have coded it in 30 seconds. A program that would translate from Python to C some basic instructions I think would do a lot of good to beginners in coding or programming! Think I might write that someday !
So I searched on Youtube and I found a guy from India that was extremely calm and relaxed – and had 75 + videos and tutorials ( Naresh Technologies). I started from 0 with every concept in C programming language, learning about all kinds of data structures, syntax, for and while loops, resolving different very small problems ( like seeing if a number is a palindrome or not ). For 5 – 7 days that is all I did and my confidence & knowledge grew a lot, I solved the problem and then I continued in the new year.
January 2020 – Problem set 4 – Recovering jpeg images from a .raw file using C programming language
Harvard studying online, programming language, edx, C programming, Programming basics
In CS50 – the Harvard online programming course – there is a task in which you have to recover some photos from a raw sequence of bytes in C programming language. After checking if the file has a correct input I had to think at how to iterate over the raw data and check if the header of the jpg corresponds with the bytes written in the raw data. If they correspond, then you found an image ! They give you a walk through code so it’s easier to implement – That walk through is a must if you are a beginner in C !
I encountered errors in initializing the file pointers and I was careful to open the files in “a” – append mode. (so every chunk of memory gets added at the end of the file). If you open the file in “w”(write) then you are replacing the actual contents of the already opened file). The problem is complex and you have to malloc and free the memory you use, otherwise you end up in a long series of Segmentation Faults errors! It was a very insightful lesson because I have really understood how the computer operates under the hood. And it is fascinating – especially the speed in which decisions can be made.
Next thing in the day I followed lecture 5 of this course. These lectures have a great artistic touch with nice abstract introductions. In almost all the courses there is a live demonstration of code in real life using people, numbers, lockers, volunteers, numbers , etc ! There are short amusing videos about coding concepts that make learning this language quite fun ! The animation with pointers is quite nice.
It is November 2019 and I finally decided to take this very nice course from Harvard through the online platform Edx. The course was a gift from my girlfriend for my birthday in late august. I started it now because until now I finished all the chapters left in Automate the Boring Stuff with Python. I really took my time and from my point of view my learning curve was acceptable. This course is a lot more complex than everything I’ve seen and quite frustrating!
CS50, EDX & Harvard University
“I am very excited to learn a little about scratch but also about some C programming – the basis of programming languages! Knowing some Python, I believe the course should’t be that hard and I think I will finish it rather quickly !” I enthusiastically told myself while I was watching the first lecture.
Boy was I wrong ! .. 🙂 The first lecture was about Google’s programming language for children mainly – Scratch. It is very graphical and quite easy to follow. I did a simple game in which a sprite follows another sprite while using keyboard arrows and when it touches it it gets a point. Kind of easy but some implementation it did not work, but I uploaded it anyway because it respected all the requirements. Got a passing score.
Before that though I had a 2- 3 days “frustration” gap because it said that we should install submit50 on our PC. I have a decent laptop with Windows installed. The issue was that they said to open the command prompt and I said pip install submit50, it gave an error that said I should install Ubuntu environment so I can assign this command. I started to install Ubuntu, and then the environment, and finally while trying to install submit50 it gave another error. I don’t know anything about Ubuntu at this moment and I became quite sad that I cannot even begin to upload my projects. It was clearly a wrong road. Somehow I have found the CS50 IDE – it wan’t that obvious where to go and what to do . Edx has a mirror platform in which you can see the lectures and assignments, I think it is misleading and doubling the initial confusion. My girlfriend was saying – it is that hard because it is from Harvard. 🙂
First contact with C
After watching lecture 1 I thought that it was an easy task to build a pyramid, but actually, aside from the Android Track in the end, I think this was the hardest course ever. You have to just create a “Mario Pyramid” – just like in the game – using C. Even though you feel you know the theory it was quite hard – I was struggling with the syntax. I wrote the code in Python in 30 seconds for this assignment. But in C it took me about 10 hours. Yep – I wrote 2 for loops in C in 10 hours!
Tips & Ticks: Just check some basic C tutorials online (I recommend “Naresh Technologies”- a tutor from Hyderabad). I did this for several hours and it saved me tons of frustration I would have had gained in the future lessons. PS. You will find the answer to Mario there as well. (You didn’t know it from me!) The next lessons seemed to me easier in comparison. After that I always followed the guidelines and the accompanying smaller lectures.
Help and resources for C language
StackOverflow was always there to help, I always got good answers from there.When you google your question, it pops up and it seems that a lot of people have the same issues! In Mario I had the issue of “control may reach end of non-void function” – this was in my case because I didn’t call the function – I just wrote the implementation of the function but never actually called it. Mind you, I am a lazy question ‘asker’, I ask only after multiple hours of brain twisting. There is also a subsection in StackOverflow that deals exclusively with this CS50 problems but the main majority of questions about this course are already answered on the original site.
The Cs50 facebook group also is a big helper. Usually there is somebody that really knows your problem and you will have an answer in maximum 1 hour. Don’t be afraid to ask, we have to begin learning somehow.
About Hope, Confidence and Perseverance
If you do a problem right, you become confident and want to jump on to the next, If you don’t solve it you become stuck and sad. Questions may arise: “Am I fit for programming?”, “Am I too old for learning coding?”. This course has a very steep learning curve because it incorporates multiple courses on the following programs: Scratch, C, Python, Java, SQL, Android Studio. There are literally 6 courses jammed into this “Introductory course”. To learn a first language and basics of programming it takes months, sometimes years, especially if you are still working or having your own Startup. To learn these programs in 7 weeks is wishful thinking ! The issue is not the ton of information you have to learn but that it can discourage you from advancing into coding forever because of the steep learning curve !
The solution of not getting discouraged is to start learning from the beginner level. If you struggle for 2 days with C syntax – do some extra tutorials, if you struggle with Python, Java, Android Studio, do the same ! Don’t lose hope, you can do it if you persevere!