# Doubly Linked List in C

Doubly Linked List in C

Structure for doubly linked list

struct dnode{
int val;
struct dnode *next,*prev;
};
[1] Insert Node:
[2] Delete Node:
[3] Print List:
[4] Print List Reverse :
[5] Find Node :
[6] Exit:
*/

# Singly Linked List in C

Data Structure Problems :

Singly Linked List :

Singly linked list has following features .

It contains int data value and next pointer which points to same kind of linked list node.

It is an extensive use of Dynamic Memory Allocation & structure.

Structure defined in following way :

struct snode{

int val;

struct snode *next;

};

Declaring a snode variable

struct snode node;

node has following variable to access

val and ptr

A C program on singly linked list.

functions used :

int create_snode(int val,struct snode **node); // To create node

int insert_snode(struct snode **head,struct snode **node );// To insert node

struct snode *find_snode(struct snode **head,int val); // To find node

int delete_snode(struct snode **head,struct snode **node); // To delete node from list

void print_sll(struct snode **head); // To print list

void reverse_sll(struct snode **head); // To reverse list

struct snode* findnthnode(struct snode **head,int lpo);// To find nth node from last in list

Code :

/* Singly Linked List Code by Codingstreet.com */

/* Following Features are provided */

/*

[1] Insert Node:

[2] Delete Node:

[3] Print Node:

[4] Reverse List:

[5] Find Nth node from Last :

[6] Exit:

*/

# Bubble sort on array

Algorithm: Bubble Sort

Code:

# Quick Sort on Array

Algorithm: Quick Sort on Array
Complexity : Average case O(n logn) , worst Case O(n^2)

Code:

Quick sort on array.

# Heap Sort on array

Algorithm : Heap Sort on Array
Complexity :O(n logn)

Heap sort in Array code in C .

# insertion sort on array

Algorithm : Insertion Sort on array
Complexity : O(n^2)

Insertion sort on array code in C .