## Recursion in C

Recursion Recursion and Iteration are two different concepts of achieving a result by a number of repeated operations. Iteration involves use of for, while and do-while loops for the repeated operation until specified condition. Recursion involves a recursive function calling itself several times until specified condition. A recursive function represents the most simpler form of…

Doubly Linked lists eliminates below drawbacks of circular lists – not able to traverse backward not able to delete and node given only points to that node. In a doubly linked list, every node has three fields – left, right and info. Each node has two pointers left and right which points to the left…

## Simulation of Josephus Problem using Circular lists

Josephus Problem Josephus problem is that some soldiers are being surrounded by their enemies and there is only one horse to escape i.e. only one soldier could escape and summon help. The remedy is to arrange soldiers’ names as a circular list. Now, any number say ‘n’ is inputed (selected) where n < number of…

## Dynamic Circular Linked Lists in C

Circular lists eliminates same drawbacks of linear lists. In as circular list it is assumed that items are inserted at the front and the list pointer points to the currently inserted node. Now, in this currently inserted circular list items, node or item is the last node of the list (and is this the rear…

## Advantages of Dynamic representation of Lists over its Array implementation

Below are the advantages of Dynamic representation of Lists over its Array implementation –  No advanced knowledge of number of nodes is required  No memory space is wasted by bulk allocation as in the case of a large array since memory space is allocated only when a node is created  A reference to a pointer…

## Dynamic Linked Lists as Queues in C

When Dynamic Linked Lists are represented as Queues, the first node represents front of queue given by q.front and last node represents the rear of the queue given by q.rear where q.front and q.rear are pointers. Thus Qinsert(q,x) and Qdelete(q) could be implemented as below – Qinsert(q,x){ p = getnode(); info(p) = x; next(p) =…

## Implementing Dynamic Linked Lists in C

List is a type of dynamic data structure which rectifies certain drawbacks of Stacks and Queues. Lists generally uses the concept of pointers which points to a memory location containing data. The basic structure of a linear linked list is a as follows –   Each item in a list is called NODE. Each NODE…