How to Implement Bubble Sort in C Program?

Here we’ll see how to implement bubble sort in C programming language. Bubble sort probably is among the first few sorting algorithms that are being taught in programming syllabus. Its popularity is not because of its performance but because of its simplicity. In fact bubble sort is not suitable in most of the practical cases because of … Continue reading “How to Implement Bubble Sort in C Program?”

How to Implement Insertion Sort in C Programming?

Insertion sort is very popular sorting algorithm which is probably taught among first few sorting techniques in programming syllabus. Its popularity is not because of its performance but for its simplicity. Its performance is not as good as quick or shell short for large number of elements but it is very simple like bubble sort. … Continue reading “How to Implement Insertion Sort in C Programming?”

How to Parse and Print XML File in Tree Form using libxml2 in C Programming?

Here we’ll see how to write C program to print XML file on the screen. XML file is widely used to store and transport data over internet. Parsing and using the data from an XML file is basic programming requirement. Format of XML file Before jumping into the code, it is important to understand the basic format … Continue reading “How to Parse and Print XML File in Tree Form using libxml2 in C Programming?”

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 in C Programming?

Here we’ll see how to write C program to remove duplicate entries from linked list. Duplicate entry means nodes with same value appear multiple times in the list. Linked list in the diagram above contains duplicate entries, 43, 24 and 5 appeared twice. We’ll write a program to remove these duplicate elements such that they appear … Continue reading “How to Remove Duplicate Entries from Linked List in C Programming?”

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 get confused which data structure we should go for. Array or linked list? Though Array and linked list have some similarities, they are two fundamentally different data structures. … 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?”