Posts

Showing posts from 2026

How to implement alarm clock in python?

              Alarm plays an important role in everyday life. If your python program sets your alarm from your input. Here, is the code follows…. How to do it? This program starts from importing the built-in files. One is datetime and another one is time. Next one is winsound to create alarm sound. First step is to create the set_alarm code. Let us get the input from user for hour and minute to set the alarm. It is named as alarm_hour,alarm_minute. Get the time now. Set the alarm time. If the time crosses, make it for tomorrow. Otherwise, set the sound for the alarm time. Code: #import built-in files import datetime import time import winsound   def set_alarm():     # Ask user for alarm time     alarm_hour = int(input("Enter hour (0-23): "))     alarm_minute = int(input("Enter minute (0-59): "))     now = datetime.datetime.now()    ...

How to create a To-Do list in python

               Planning is very important for any task management. Let us create a To-Do list using python. Steps to follow: ·        This program starts with importing a built-in   file ‘os’. ·        F_NAME is the file name. it is assigned with a txt file name. ·        There are three functions. ‘load_it()’,’save_it()’,’show_it()’. ·        ‘load_it()’ opens the file if exists. Otherwise, it displays the error message. ·        ‘save_it()’ opens the file and writes the content which was given by user. ·        ‘show_it()’ displays the todo list tasks. ·        ‘main()’ function displays the options. Based on the user preference, the data is read,write and display accordingly. Code: import os F_NAME = "todolist.t...

How to run the automation scripts in python?

Image
What are automation Scripts?               A code that can be reusable to execute a function in multiple times. It automatically executed without any user intervention. In python, it is stored with ‘.py’ extension. Steps to execute the automation scripts: 1.Python Installation ·        First, make sure that system has python. ·        Just check the version in command prompt. ·        Open the command prompt by giving ‘cmd’ command in search panel. ·        It opens the command prompt. ·        Use the below syntax to check the version. C:\Users\rajeswari jeevananth>python --version Python 3.10.0 2. Set up your Environment for windows ·      Create a project folder. 3. Create the automation script     ...

Maze Solver in C

               It is a classical project. It is implemented by the use of graph traversal algorithm. It mainly finds the path from starting point to the end point. Here, maze is represented as a 2D matrix. Walls are marked as 1 and paths are marked as 0. C implementation: ·        It starts from including header file. ·        First, the rows and columns are defined as 5. ·        Maze is initialized with values. ·        Visited value is created. ·        solveItMaze() function is used to solve the maze. ·        This function is used to visit all the rows and columns to find the path. The path starts from starting point to end point. ·        Main() function checks for path is not equal to 0,0. ·        ...

Student Information System Project using Linked List and BST in C

               Let us create a simple project for Student Information System. It uses a Linked list and Binary Search Tree. //   First, a student structure is created with rollno, name ,marks and a pointer next. #include <stdio.h> #include <stdlib.h> #include <string.h> // Let us   create Student structure typedef struct Student {     int s_rollno;     char s_name[50];     float s_marks;     struct Student *next;    // Self Referential structure } Student; // BST Node structure is created typedef struct BST_Node {     Student *student;     struct BST_Node *left, *right; } BST_Node; Student *head = NULL;    // Linked List head is assigned as NULL BST_Node *root = NULL;    // BST root // create function to memory allocation Student* createStudent(int roll, char nam...

Representation of Graph using adjacency list in C

     This is the next type of graph representation. In the previous post, the adjacency matrix is used to represent the graph. You can visit the below link to access the adjacency matrix. https://rajeeva84.blogspot.com/2026/05/representation-of-graph-using-adjacency.html It makes use of linked list . It uses vertexes. It   #include <stdio.h> #include <stdlib.h>   struct g_Node {     int g_vertex;     struct g_Node* g_next; }; struct Graph {     int num_Vertices;     struct g_Node** adjLists; }; // let us Create a node struct g_Node* createNode(int v) {     struct g_Node* newNode = malloc(sizeof(struct g_Node));     newNode->g_vertex = v;     newNode->g_next = NULL;     return newNode; } // here, is the graph code struct Graph* createGraph(int vertices) {     struct ...

Representation of Graph using adjacency matrix in C

              Graph is a non-linear data structure. It can be represented by adjacency matrix or adjacency list. Let us discuss the methods in detail. This blog post deals with the first method Adjacency matrix. Adjacency matrix:               It is a two-dimensional matrix.it deals with the edges present between nodes.   If the edges found, it assigns the weight as 1. Otherwise, it values it as 0. Code implementation: This code includes the built-in header file. It defines the vertices as 4. A function ‘Display_Matrix()’ is used to represent the graph. ‘main()’ function initialises the graph. It assigns the value for matrix.  Finally,it calls the ‘Display_Matrix’ function to display the output. Code: #include <stdio.h> #define V 4   // Declare the number of vertices void Display_Matrix(int graph[V][V]) {     for (int i = 0; ...

How to find a height of a binary tree and counting the leaf nodes in C?

               Binary tree is a tree which has two nodes. It has a root node. It has a left sub tree and right sub tree. Let us implement the c program to count the leaf nodes and height of a binary tree. C implementation:               This implementation starts by including header files. Next, declare the node structure for tree. It has node with data, left and right values. Now, a new node is created by allocating its memory. The values are initialised.   To calculate the heights of the tree, traverse the tree. To count the leaf nodes, check the root nodes, traverse each sub tree separately and count the nodes. In the main() function, create the root node and all child nodes by using the newNode() function. Call the height() function and countLeafNodes() function to display the output. C Code: #include <stdio.h> #include <stdlib.h> // D...

How to delete a node in Binary Search Tree?

               As we discussed the basic operations in Binary Search Tree , here we implement the delete operation in Binary Search Tree . Deletion can be implemented as three types. ·        Node has one child – you can replace the node with its child node. ·        Node has two children – it changes the node to the smallest value in the right                                                 Subtree and deleted the successor. ·        Node has no child – it deletes the node. #include <stdio.h> #include <stdlib.h> // Create   BST node struct BST_Node {     int b_data;     ...

Binary Search Tree operations in C

               Binary Search Tree is a binary Tree which follows a unique key and tree ordering. It strictly follows the left and right nodes values should be in order in such that it satisfies the binary tree condition. Let us implement the searching in Binary Search Tree in C language. Program implementation: It includes the header files. The Node is created first. It has a data, left child and right child. To create a node , memory should be allocated. The data, left, right node pointers are assigned with the node. Next, insert function is created. It reads the data and assigns the left and right pointer. Search function is implemented. It gets the value from the user. It checks the value in the tree. If the value is found, it displays the found message. Otherwise, it displays not found message. Finally, it prints the value.   C Code: #include <stdio.h> #include <stdlib.h> struct BST_Node { ...

Pre order and Post order traversal in a binary tree – C program

       Binary tree is a tree which has almost two child nodes for each node. It can be traversed by three ways. Preorder, Post order and in order are the three types.  In order traversal is implemented in previous blog post. Pre order and post order traversals are implemented here…. C implementation: It starts from the including the header files. First, a structure of the node is declared. It has a data, left and right members. ‘create_Node()’   gets the input as data. It allocates the memory. it assigns data and its child data. Preorder Traversal: It follows Root -> Left -> Right principle.   Postorder Traversal: It follows Left -> Right -> Root principle. Finally, main() function calls the functions and display the output. Code: #include <stdio.h> #include <stdlib.h> // Define the structure of a node struct b_Node {     int b_data;     struct b_Node *t_left, *t_right...