Skip to main content

Posts

Memory management

#include <stdio.h> #include <stdlib.h> int main() {         int* ptr;         int* ptr1;         int n; int i;int sum = 0;         n = 5;         printf("Number of elements: %d", n);         ptr = (int*)malloc(n * sizeof(int));         ptr1 = (int*)calloc(n, sizeof(int));         if (ptr == NULL || ptr1 == NULL)         {             printf("\nMemory not allocated.");         }         else         {                 printf("\n\nMemory successfully allocated using malloc.");                 for (i = 0; i < n; ++i)                 {         ...

Pygame tutorial

Before I introduce: I have a long desire to develop some games I can play. And recently, I have been able to learn the first few steps of that. I have created a prototype of the famous and one of the most ancient games,  pong . My version of this game currently do not contain score boards, or starting screen. The game somehow looks like this: Here the green dashes are the players, the name of the game is two player pong, and the white square is the box. I will write a thorough tutorial on the code, which is on my github, about how to develop an easy game like this. You can check my github page for the game  here .  Hope to see you soon, on the hands on tutorial session to be uploaded here on this blog. Introduction: First things first. I have developed the game using pygame in a jupyter notebook. So, first consider the imports as below: I have used the template created by chris of Kidscancode. However, there are multiple changes. In this case, I ha...

Hashing

Part 1: Hashing is the last topic of all these data structure blogs I have been writing about. I will try to sum up hashing from the basics, but in easier languages and as usual with algorithms and full programs. This post will be also a long and ever increasing post. So, keep close and keep studying. Introduction: Let me say that you are coding a database for a coaching institute and want to create a system for looking up each student's result. Now, here the main requirement is to have a high lookup speed. First thought which will come to your mind is the balanced binary tree. In this binary tree, it is guaranteed to have log(n) timed search, updating and balancing operation. But, although log(n) is not high, it can soon go up to higher numbers pretty soon. So, we, in this post, will discuss a much better approach.  What is hashing?  Hashing is a technique of creating a array where the entry of the array and the index are related by a certain function, enablin...

Trees | tree traversals, pre-order post order and in-order traversal | set 2

Introduction: In a previous post , we have seen how to construct a basic tree[we constructed binary tree].If you don't have any experience with writing tree structures, then you may very well visit the first post and then continue this one. Now, we want to show what are the ways to traverse a binary tree. There are mainly 3 ways to traverse the binary tree. The ways are in-order, pre-order and post-order.  Algorithms: The in-order traversal is a process of traversing the left subtree first, then the root and at the last, right subtree. The algorithm is recursive; i.e. the algorithm of in-order is similar: Traverse left sub-tree traverse the root Traverse right sub-tree Here, as the left-subtree will be traversed again in the same way with the left node considered as root. Therefore, the program works recursively. The post-order is again a recursive. But in this case, it traverses the root at the last. Therefore it is called post-order. The algorithm is: ...

I made a youtube-bot(selenium driven web scraping article)

Select Language Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Gujarati Marathi Nepali Punjabi Tamil Telugu Before I start: Warning: Do not try the whole program. this will disable your youtube account for spamming reasons. So, I recently wanted to go to everyone, and tell that I have started a blog. So, I thought, why not go to youtube videos related to my contents and drop links? so I planned to do the same. But, there are so many youtube videos, and I have only so less time. So I planned to...

Automate the boring stuff with python review

Select Language Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Gujarati Marathi Nepali Punjabi Tamil Telugu   Hi friends, so, I am starting to read the book named Automate the Boring stuff with python, by Al Sweigart. In this blog, I will continue to update my experience with this book. You can also read-only from  here . I recently uploaded a selenium based automation bot in youtube to GitHub and shared the link in Reddit to get reviews about the same. There one user suggested me to re...