Linux Sample Programs

Program to find the middle of a linked list

August 29th, 2009  |  by  |  published in Amit Sahrawat, Data Structures, Linux Sample Programs

/* Structure for a linked list*/ struct list{     int num;     struct list* next; /* pointer to next node in list*/ }; /* Function to find the middle node for the linked list, given the starting node pointer*/ struct list* middle(struct list* head) {

Program to remove duplicates from a linked list

August 29th, 2009  |  by  |  published in Amit Sahrawat, Data Structures, Linux Sample Programs

/* Structure for a linked list*/ struct list{     int num;     struct list* next; /* pointer to next node in list*/ }; #define FREE(x) free(x);x=NULL; /* Function to remove duplicates from a linked list, given the head pointer for the list*/ void removeDuplicates(struct list** head) {

Program to split a linked list from a given position

August 29th, 2009  |  by  |  published in Amit Sahrawat, Data Structures, Linux Sample Programs

/* Structure for a linked list*/ struct list{     int num;     struct list* next; /* pointer to next node in list*/ }; /* Function to split a linked list into two parts, given the position from which to start splitting*/ void split(struct list* head, struct list** dest, int position) {

Program to delete a node from a linked list

August 29th, 2009  |  by  |  published in Amit Sahrawat, Data Structures, Linux Sample Programs

/* Structure for a linked list*/ struct list{     int num;     struct list* next; /* pointer to next node in list*/ }; #define FREE(x) free(x);x=NULL; /* Function to delete a node from a linked list, given the value for the node*/ int delete(struct list** head, int value) {

Program to find length of linked list using Recursion

August 29th, 2009  |  by  |  published in Amit Sahrawat, Data Structures, Linux Sample Programs

/* Structure for a linked list*/ struct list{     int num;     struct list* next; /* pointer to next node in list*/ }; /* Function to find the length of linked list using recursion, given the starting node pointer*/ int length(struct list* node) {

Program to print linked list in reverse order using Recursion

August 29th, 2009  |  by  |  published in Amit Sahrawat, Data Structures, Linux Sample Programs

/* Structure for a linked list*/ struct list{     int num;     struct list* next; /* pointer to next node in list*/ }; /* Function to print data in reverse order for a linked list, given the starting node pointer*/ void reverseprint(struct list* node) {

Program to traverse the linked list

August 29th, 2009  |  by  |  published in Amit Sahrawat, Data Structures, Linux Sample Programs

/* Structure for a linked list*/ struct list{     int num;     struct list* next; /* pointer to next node in list*/ }; /* Function to traverse the linked list given the starting node pointer */ void traverse(struct list* node) {

Program to insert a node in the linked list

August 29th, 2009  |  by  |  published in Amit Sahrawat, Data Structures, Linux Sample Programs

/* Structure for a linked list*/ struct list{     int num;     struct list* next; /* pointer to next node in list*/ }; /* Function to insert node into a linked list, given the head pointer and the value to be inserted */ void insert(struct list **head,int value) {

Concept of Memory Management using Memory Pools

August 1st, 2009  |  by  |  published in Amit Sahrawat, Linux Sample Programs, Technology

Concept of Memory Management using Memory Pools

Introduction Memory Management Malloc based memory management Pool concepts Type of Pools  Introduction Memory management subsystem is one of the most important parts of operating systems. It is very important to know about the abilities and limitations of memory manager.

Program to write ‘printf’

May 16th, 2009  |  by  |  published in Linux Sample Programs

#include <stdio.h> #include <stdarg.h> /* minprintf: minimal printf with variable argument list */ void minprintf(char *fmt, …) { va_list ap; /* points to each unnamed arg in turn */ char *p, *sval; int ival; double dval; va_start(ap, fmt); /* make ap point to 1st unnamed arg */ for (p = fmt; *p; p++) { if […]

Subscribe

Get articles in your inbox.

Enter your email address:

Join Us

Twitter Chatter


Recommendations

Archives

Categories