Posts

Featured post

Design an algorithm and c-program to insert a data element into sorted single linear linked list (SLLL).

 Design an algorithm and c-program to insert a data element into sorted single linear linked list (SLLL). Algorithm: Insert sort SLLL. Input: 1) F, address of a first node of sorted list.2) e element to be inserted. Output: F, Updated. Method:  n = getnode() [n].data = e if ( F= = NULL )      [n].link = = NULL  F = n elseif ( e < = [ F ].data ) then [n] .link = F f = n else T = F // check the list for next node while (( [ T ].link ! = NULL ) and ( [ [ T ] . link] . data < e ) ) do      T = [ T ] .link while end [ n ].link = [ T ].link [ T ].link = n if ends if ends Algorithm ends  // C PROGRAM #include <stdio.h> #include <stdlib.h> // Structure of a node struct Node {     int data;     struct Node* link; }; struct Node* F = NULL; // Head of the list // Function to insert a node in sorted order void insertSorted(int data) {     struct Node* newNode = (struct Node*)malloc(sizeof(struct Node))...

RESUME 2025 AUG

MY RESUME 01/08/2025 ========================================================================= PDF version of my resume 1/AUGUST/2025 https://drive.google.com/file/d/1VkKwQNF-m9w2_FiJ7FT0phNeY9MuQWl6/view?usp=sharing ========================================================================== DOC Version of my resume 1/AUGUST/2025 https://docs.google.com/document/d/108WiLLDZo-9l1sgaSSutkQZaE8iIma3g/edit?usp=drive_link&ouid=111069544115391871585&rtpof=true&sd=true ==========================================================================

The function accepts two positive integers ‘r’ and ‘unit’ and a positive integer array ‘arr’ of size ‘n’ as its argument ‘r’ represents the number of rats present in an area, ‘unit’ is the amount of food each rat consumes and each ith element of array ‘arr’ represents the amount of food present in ‘i+1’ house number, where 0 <= i

Problem Description : The function accepts two positive integers ‘r’ and ‘unit’ and a positive integer array ‘arr’ of size ‘n’ as its argument ‘r’ represents the number of rats present in an area, ‘unit’ is the amount of food each rat consumes and each ith element of array ‘arr’ represents the amount of food present in ‘i+1’ house number, where 0 <= i Note:   Return -1 if the array is null Return 0 if the total amount of food from all houses is not sufficient for all the rats. Computed values lie within the integer range. Example:   Input:   r: 7 unit: 2 n: 8 arr: 2 8 3 5 7 4 1 2 Output:   4   Explanation: Total amount of food required for all rats = r * unit   = 7 * 2 = 14.   The amount of food in 1st houses = 2+8+3+5 = 18. Since, amount of food in 1st 4 houses is sufficient for all the rats. Thus, output is 4. C- Program for the above problem description is given below. #include<stdio.h> #defin...

Linked List

Image
What is linked list? A collection of nodes, each node contains two parts, an data part and an link part. Data part:- data part of a linked list contains the data to be stored in linked list. Link part:- which contains the address of the next node. In the case of the current node is only node in the list or current node is last node in the list then address part contains NULL value in it. Such a linked allocation based structure is called Linked list. Types of linked list:- There are 3 types of linked list. 1. Single Linked List (SLL). 2. Circular Linked List (CLL). 3. Double Linked List (DLL). Some basic algorithms: 1.Design an algorithm to insert an element 'e' into a single linked list (SLL). So that the inserted element becomes first in the list. Algorithm:- Insert_First_SLL. Input:- F, address of first node of SLL.             e, element to be inserted. Output:- F, updated. Method:-      n = CreateNode();      n.data = e; ...

Chessboard distance or Minkowski distance

Image
Consider two objects and describe by 10 features and write a c-program to compute Lr distance by the varying the “r-value”. The C-program automatically reads the 10 random number and the value of r going to increment automatically up to 50. Our infinity value is set to 50, can be changed to the desired value. the r-value is 1 then it is called the city-block distance, if the value of r is 2 then it is called Euclidean distance and if the value of r is infinity then it is called as a chessboard or Lr distance, supremum distance (also referred to as L max , L ∞ norm and as the Chebyshev distance ) is a generalization of the Minkowski distance for L → ∞. The C-program automatically reads the 10 random number and the value of r going to increment automatically up to 50. Our infinity value is set to 50, can be changed to the desired value. The c-program is as follows: #include<stdio.h> #include<stdlib.h> #include<math.h> #include<floa...

Feature evaluation: Unsupervised model and supervised model

Image
Unsupervised model Here, Variance can be used as evaluation criteria. The maximum variance ranked first. Descending order sorting of variances. Fig: Unsupervised feature selection model. Rank the features based on variance and chose top "d" features. This is called unsupervised feature selection or elimination model.  Supervised model:  Fig: Supervised feature selection model. Equation: Mean. Fig: Mean of individual classes. Here, Fig: ICV < BCV. The minimum variance ranked first. Ascending order sorting of variance. Compute: Intra class variance (ICV)/within class variance: Inter class variance/between class variance(BCV): Ration from BCV to ICV is high. Fig: Ratio from BCV to ICV. Chose the one feature with the highest rank as first.  This is called as Ward's or Fisher's criterion. This is only for supervised learning. This is used in the Fisher's Linear Discriminant Analysis technique ...

Feature evaluation criteria

Feature sub-setting is through selection or elimination. We look approximation algorithm: Feature evaluation criteria. Feature are ranked. Select top 'd' features. 1 and 2 could be independent of learning algorithm (unsupervised). Example: Filtering algorithm (filters)/model. Ex: Big data, independent of class label. Then it is called as unsupervised feature selection (classification). 1 and 2 could be dependent of learning algorithm (supervised). Example: Wrapper algorithm (wrappers)/model. Ex: Small data, class label/class information dependent. Then it is called as supervised feature selection (clustering).