How to Remove Duplicate Entries from Sorted Linked List using C Programming

Here we’ll see how to remove duplicate entries from sorted Linked List using C Programming. In the previous article we saw how to remove duplicate entries from a generic linked list which will work here for sorted linked list also. But we’ll see how to take advantage of the sorted list and improve the performance … Continue reading “How to Remove Duplicate Entries from Sorted Linked List using C Programming”

How to Remove Duplicate Entries from Linked List?

Here we’ll see how to write C program to remove duplicate entries from linked list. Linked list contains duplicate entries when nodes with same value appear multiple times in the list. In the above Linked list entries, 43, 24 and 5 appeared more than once. We’ll write a C program to remove these duplicate elements … Continue reading “How to Remove Duplicate Entries from Linked List?”

When to Prefer Linked List over Array in C?

As a C programmer when we need to deal with multiple data elements of same type, we think of using array or linked list. Many times we scratch our head which data structure we should go for.. Though Array and linked list have many similarities, they are two fundamentally different data structures. Let’s see when … Continue reading “When to Prefer Linked List over Array in C?”

How to Implement Singly Linked List in C?

What is singly linked list? In computer science, linked list is a collection of data elements, also called nodes, which are connected or linked by means of pointers or references. Connected or linked means if you have access to an element, you can go to the next element. In Singly linked list the links are unidirectional. … Continue reading “How to Implement Singly Linked List in C?”

How to Access MySQL Database from C Program?

MySQL is an open sourcce database management system (DBMS). It is very popular among the web developers as it is part of LAMP (Linux, Apache, MySQL, PHP/Perl/Python) stack. Many popular large scale websites like WikiPedia, Facebook, Youtube use this database. Many times we need to use access MySQL database from C program. Here we’ll see … Continue reading “How to Access MySQL Database from C Program?”

SQL Query to Find Second Highest Salary

Finding second highest salary from an employee table using SQL is a classic problem the job seekers often face as their interview question. Database programmers also have to solve similar problem like finding Nth highest number from a table. Finding the maximum salary from an Employee table is very trivial but finding second highest is bit … Continue reading “SQL Query to Find Second Highest Salary”

How to Implement Periodic Timer in Linux?

As a programmer we often need to do some task repeatedly after some time interval. We can think of a simple loop containing a function call to do the task followed by a sleep() call to wait for some time.  This seems to be very simple solution but what if we don’t want to sit ideal … Continue reading “How to Implement Periodic Timer in Linux?”

Loop in Linked List, How to Detect and Remove in C Programming?

What is loop in linked list? Loop in linked list means you can traverse the list endlessly. If you traverse a linked list with loop, you will hit all or some of the nodes again and again. We’ll see how this is possible. Consider the normal (without loop) linked list above. Head points to the … Continue reading “Loop in Linked List, How to Detect and Remove in C Programming?”

C Program to Sort Linked List without Allocating Extra Memory

We’ll first create a linked list which is not sorted, then we’ll re-arrange the list such that the list becomes sorted. Logic is simple, we’ll iterate the list for all nodes, in every iteration we’ll take the first node out of the original list and insert that node into a new list. At any point … Continue reading “C Program to Sort Linked List without Allocating Extra Memory”

C Program to Convert Binary Number to Decimal

Binary number system is 2-based which means at most two symbols, 0 (zero) and 1 (one), can be used to represent a binary number. Example of binary number is 110110011, sometimes binary numbers are written as 1101100112, where 2 is represented as base of the number system. Binary number system is the basis of all computer and digital systems. … Continue reading “C Program to Convert Binary Number to Decimal”