The basic aim of mycplus.com 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 structures and their implementation in C/C++.

National Institute of Standards and Technology (NIST) defines data structure as

“An organization of information, usually in memory, for better algorithm efficiency, such as queue, stack, linked list, heap, dictionary, and tree, or conceptual unity, such as the name and address of a person. It may include redundant information, such as length of the list or number of nodes in a subtree.”

NIST

A data structure is a way of storing and retrieving data efficiently. There are two main objectives to study data structures. First one is to identify and develop useful entities and operations and decide what type of problems can be solved with these entities and operations. The second one is to decide how to represent those entities and implement operations on those representations.

Two Types of Data Structures

There are two types of data structures are available to C/C++ programmers. One type of data structures are already built into C/C++ programming languages. These can be Arrays, Structures and classes. Other one is complex data structures that can be implemented using built in data types and structures in C/C++ programming languages. Some of the examples of these data structures are Stack, Queue, Linked List, Tree and Graph.

Sometimes built in data structures do not fulfil the requirements and we have to implement our own data structures. All of these complex data structures have their own strengths and weaknesses. Also they have their own usage in real life computer applications. Efficiency of these data structures can be measured by two factors (Time, Space).

  • First one is the time taken to complete the instruction and give the output.
  • If an application uses large amount of the structures, thus it will take more space to store and represent these structures.

In the coming articles I will try to explain the theory of each of data structures along with C/C++ code examples. Also I will try to implement the complete data structure in either C or C++ and provide the complete source code along with the article.

Here is a brief list of data structure articles:

ArticleDescription
Binary Decision Diagram Data Structure  A BDD (Bryant 1986) or branching program is a data structure that is used to represent a Boolean function.
Trie Data Structure  A trie (Fredkin, 1960), also called digital tree and sometimes radix tree, is an ordered multi-way tree data structure that is used to store a dynamic set or associative array where the keys are usually strings.
Arrays as Data Structure in C/C++The aim of this tutorial is to teach you how to declare, initialize and use simple arrays as well as multidimensional arrays. 
Data Structure Library  Ubiqx is a collection of ANSI C compatible modules for implementing linked lists, binary trees, caching and spare arrays.
Bayer Tree implementation in C  This is implementation of Bayer Trees, sometime referred to as Balanced Tree and normally used for indices of databases. 
Unions and Structures in C Programming  A union in C programming is a user defined data type which may hold members of different sizes and type. Union uses a single memory location to hold more than one variables. A structure is a convenient tool for handling a group of logically related data items. Structure help to organize complex data is a more meaningful way.

Directory Traversing in C using Tree Data Structure
This is a C Program to implement tree data structure. It uses current working directory as the root and traverse all files inside the directory and prints them on the screen.
Stack Implementation in CStack is a very useful data structure for real life scenarios and used in many other data structures. For example, Processors, Operating System Calls, Converting an Infix to Postfix, Recursive functions, Reverse operations etc.