All Articles

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…

All Articles

Doubly Linked Lists

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…

All Articles

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…

All Articles

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) =…

All Articles

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…