Inserting in a sorted linked list means that the linked list will remain sorted after the insertion. So to insert a new element, we need to find out the appropriate place and insert the new node there. Logic to Insert an Element in a Sorted Linked List If head points to NULL or the new … Continue reading “Insert an Element in a Sorted Linked List”
C Program to Check Whether a Number is Odd or Even
Here we’ll see different techniques to check whether a number is odd or even. Check odd or even using modulus operator Even numbers are always divisible by 2. If you do the modulo operation on the given number with 2 and the reminder is 0,then the number is even, otherwise, odd. This principle is applied … Continue reading “C Program to Check Whether a Number is Odd or Even”
How to Delete a Node from Singly Linked List?
Here we’ll see how to write C program to delete a node from singly linked list. In this example, the node to be deleted will be identified by the value of the node. Logic to Delete a Node from Singly Linked List If the first node (where the head points to) matches with the value to be deleted. … Continue reading “How to Delete a Node from Singly Linked List?”
C Program to Insert a Node in a Linked List
Inserting a node is one of the the most fundamental linked list operations. We need to insert new nodes to create a linked list in the very first place. Here we’ll see how to write C program to insert a new node into a linked list at all four possible positions: Let’s start with the … Continue reading “C Program to Insert a Node in a Linked List”
C Program to Get a Digit of Any Position of a Number
Here we’ll see how to write C program to find a digit of a specified position in a number. We’ll start the numbering from right side. The right most position would be 0. For example, 0-th digit of 2341238 is 8 and 3-rd digit is 1. Logic to Find N-th Digit of a Number Do … Continue reading “C Program to Get a Digit of Any Position of a Number”