Find the middle element of linked list in C

In order to find middle element of linked list in one pass, you need to maintain two pointers, one increment at each node while other increments after two nodes at a time. By having this arrangement, when first pointer reaches end, second pointer will point to middle element of linked list.

Binary Trees

A binary tree is made of nodes, where each node contains a “left” pointer, a “right” pointer, and a data element. The “root” pointer points to the topmost node in the tree. The left and right pointers recursively point to smaller...

Arrays as Data Structure in C/C++

As discussed in the previous post, there are two types of data structures available to C and C++ programmers. One is already built into the programming language such as arrays and structures. Other type of data structure is a bit complex in a sense that it can be...

Data Structure Articles

The basic aim of website was to develop a website for students of C/C++ and data structures. There are lots of tutorials and source code covering different aspects of C/C++ programming language. Today I have decided to write few articles about data...

Did you find this post useful? Please consider sharing with your friends and colleagues:)