Data Structures

This page contains detailed tutorials on different data structures (DS) with topic-wise problems.

Topics :

 What is Array? 
An array is a data structure that contains a group of elements. Typically these elements are all of the same data type, such as an integer or string. Arrays are commonly used in computer programs to organize data so that a related set of values can be easily sorted or searched.
Explore Problems


 What is Recursion? 
The process in which a function calls itself directly or indirectly is called recursion and the corresponding function is called as recursive function. Using recursive algorithm, certain problems can be solved quite easily.

What is base condition in recursion?
In the recursive program, the solution to the base case is provided and the solution of the bigger problem is expressed in terms of smaller problems.


int fact(int n)
{
    if (n < = 1) // base case
        return 1;
    else    
        return n*fact(n-1);    
}


In the above example, base case for n < = 1 is defined and larger value of number can be solved by converting to smaller one till base case is reached.

Explore Problems

 

A tree whose elements have at most 2 children is called a binary tree. Since each element in a binary tree can have only 2 children, we typically name them the left and right child.
 

A Binary Tree node contains following parts.

  1. Data
  2. Pointer to left child
  3. Pointer to right child
 
 
 In Linked List we can dynamically allocate the memory. We have mainly three types of linked list singly linked list, doubly linked list and circular linked list.
 




No comments:

If you have any doubt or suggestion let me know in comment section.

Powered by Blogger.