List Flattening and Unflattening

FLATTENING LIST PROBLEM: Start with a standard doubly linked list. Now imagine that in addition
to the next and previous pointers, each element has a child pointer, which
may or may not point to a separate doubly linked list. These child lists may have
one or more children of their own, and so on, to produce a multilevel data structure,
as shown in the figure below:

Continue reading »

LinkedList Problem 1

PROBLEM: head and tail are global references to the first and last element, respectively, of a singly linked list of integers. Implement  functions for the following prototypes:

Continue reading »

Implementing a Stack

Following the series about CS101 datastructures lets understand and implement a stack.
A Stack is a list on which items are added and remove in FIFO order (First In First Out).  Lets see a picture to better understand a Stack.

Continue reading »