Tag Archive: linked lists

RingBuffer implementation

The ring buffer can be implemented using a simple array of items. We need to keep track of two indexes between which useful data is actually stored. The enqueue operation moves the last… Continue reading

Quick problem: reverse a linked list

The iterative solution:  Iterating through the list, we append the reversed result to the current node; then the reversed result encapsulates the current node; and finally, we advance in the list using a previously… Continue reading

Circular queue implementation

The trick here is that you need a pointer to the last element in the circular linked list. Inserting items in the linked list can happen replacing the last element or after the… Continue reading

Quick problem: find kth element from the end of a linked list

The solution to this problem requires the use of two pointers. The first pointer will be advanced k times from the start of the linked list. Afterwards, the second pointer will be advanced from… Continue reading