algorithms

Algorithm for Algorithm

We have advanced so much with data science, machine learning and artificial learning that sometimes I really wonder if writing an algorithm would makes sense. With changing data, algorithm turns out to be highly dynamic and difficult to predict how it might behave after certain point of time if we are not aware of type… Continue reading Algorithm for Algorithm

algorithms

Check if Number is Odd Using Bitwise – C

An odd number always has the LSB set to 1. If we AND the given number with 1, the even number will always turn out to be zero. We can using this to check if the number is odd or even. Examples: 1) n = 4 100     (4) 001     (1) ———– AND 000… Continue reading Check if Number is Odd Using Bitwise – C

algorithms

Case Conversion using Bitwise – C

We generally use the functions strlwr() and strupr() available under string.h to toggle between the cases. This can also be achieved using bitwise operations. Before that, lets understand the ASCII table. ASCII of A is 65 (1000001) ASCII of a is 97 (1100001) Similarly, ASCII of Z is 97   (1011010) ASCII of z is 122 (1111010)… Continue reading Case Conversion using Bitwise – C

algorithms

Pointer and Types – C

This note covers various types of pointers to be aware of and a few notations used with pointers. Types of Pointers Pointer: Pointer is a variable which holds the address of another variable NULL Pointer: A null pointer has a value reserved for indicating that the pointer does not refer to a valid object. It… Continue reading Pointer and Types – C

algorithms

%d and %i format specifiers – C

What is a format specifier: It basically tells us what type of data we are dealing with, while reading(scanf()) or writing (printf()). It is a sequence starting with a % sign. While reading integers, we can go for %d or %i. %d assumes base 10 and %i auto detects it. To be more specific, %d specifies… Continue reading %d and %i format specifiers – C

algorithms

Union-Find Data Structure: Intro

A disjoint-set data structure, also called a union–find data structure keeps track of a set of elements partitioned into a number of disjoint (non-overlapping) subsets. With this setting we define the following operations: Find: Determine which subset a particular element is in. This can be used for determining if two elements are in the same… Continue reading Union-Find Data Structure: Intro