C/C++

Trees in C++ Final part

Submitted by moazkhan on

Trees in C++ Final part

In this tutorial, you will learn 1. Different types of traversal of BST 2. Concept and implementation of inorder traversal 3. Concept and implementation of preorder traversal 4. Concept and implementation of postorder traversal What are different types of traversals of BST? In trees, there are three types of traversals 1. In-order traversal 2. Post-order traversal 3. Pre-order traversal What is in-order traversal? In inorder traversal, first the left child is accessed then root and then right child at last.

Binary Search Tree in C++

Submitted by moazkhan on

Binary Search Tree in C++

Note: We will use BST as abbreviation for binary search trees. Code is given with the tutorial separately for thorough understanding. In this tutorial, you will learn 1. About the data members of class of BST. 2. Implementation of constructor of BST. 3. Implementation of function to check whether BST is empty. 4. Implementation of function to insert a node in BST. What are the data members of BST? The class of Binary search tree has only one data member which is a pointer to the node of BST. It is named as root.

Trees in C++

Submitted by moazkhan on
Trees in C++ Now, we know the basics of efficiency analysis and if I find some space in tutorial, efficiency calculation will be discussed but mean while, it is very important to cover other important data structures.

Efficiency Analysis in C++

Submitted by moazkhan on
While explaining previous tutorials, I was finding it difficult to explain various functions as I could talk in terms of efficiency and order. So, I have decided to include this earlier. In this tutorial, you will learn 1. What efficiency means. 2. Why time is more important than space. 3. The meaning of growth rate. 4. Explain different orders of growth. What is efficiency of a program? Efficiency of a program is directly related to the time and computer space it needs for execution.

Learning Queues in c++

Submitted by moazkhan on

Learning Queues in c++

In this tutorial, you will learn 1. The concept of queues 2. Implementation of queue 3. Array Based implementation of queues What is the concept behind queues? Queue is a type of data structures which works on the basis of First In First Out “FIFO”. It means that the data coming first is discharged first. Thus, data is entered from one end and taken out from other end. It is a linear data structure. Example: To understand, queues better, we can take example of a ticket line. In a line, the person entering first is always served first.

Stacks Using C++ Part2

Submitted by moazkhan on

Stacks using c++ part2

In this tutorial, you will learn 1. When stacks should be implemented by arrays. 2. When stacks should be implemented by linked list. 3. Implementation of stacks using linked list. When should the stacks be implemented by linked list? In stacks, data is entered and removed from same end. So, there is no insertion and deletion from middle. As we learnt that while inserting data in the middle of an array, this creates a problem. Since in stacks, data is inserted and removed from one end only.

Introduction to Stacks

Submitted by moazkhan on

Introduction to Stacks

In this tutorial, you will 1. Learn the concept of stacks. 2. Be given practical examples of LIFO 3. Learn what the types of implementation of stack are? 4. learn the array based implementation of stacks. What is the concept of stacks? The concept of stacks is very simple. It is that if you insert an element in a stack, it always occupies top position and when you remove element, the element at top is always removed. i.e. the element inserted last is removed first. Another name given to such insertion is LIFO i.e. last in first out.

Linked List using C++ part5

Submitted by moazkhan on

Linked List using C++ part5

In this tutorial, you will learn 1. Code of adding a node in middle of an ordered linked list. 2. Code for deleting a node in the middle of linked list. What is the code for adding a node in any location in ordered linked list? If you have read the previous tutorial, you already know that an ordered linked list is one in which data is arranged in ascending order. So when you add data in such a list, it must not distort the ascending order of list. Hence, you cannot add data anywhere in the list.