Blog

C Program for Depth First Binary Tree Search without using Recursion

C Program for Depth First Binary Tree Search without using Recursion : The following C program performs a Depth First Search traversal. Depth-first search (DFS) is an algorithm for traversing or searching a tree, tree structure or graph. The concept of backtracking is used in DFS. In this program we are performing DFS on a binary tree. In DFS,...

C Program to Traverse the Tree without using Recursion

C Program to Traverse the Tree without using Recursion : This C program will traverse the tree without using Recursion. The following C program, using iteration, searches for a given node in a tree. The tree we have used is the binary search tree. A binary search tree follows a concept of the nodes whose numbers are lesser than...

C Program to Search for an Element in the Linked List without using Recursion

C Program to Search for an Element in the Linked List without using Recursion : This C program, using iteration, searches for an element in a linked list. A linked list is an ordered set of data elements, each containing a link to its successor. Here is the source code of the C program to search for an element in...

C Program to Solve Tower of Hanoi Problem using Recursion

The tower of hanoi is a mathematical puzzle. It consists of three rods, and a number of disks of different sizes which can slide onto any rod. The puzzle starts with the disks in a neat stack in ascending order of size on one rod, the smallest at the top. We have to obtain the same stack on the...

C Program to Solve the Magic Squares Puzzle

The following C program finds the magic square for a given odd sized number, using iteration. A magic square is an arrangement of numbers from 1 to n^2 in an matrix, with each number occurring exactly once, and such that the sum of the entries of any row, any column, or any main diagonal is the same. Here is...

C Program to Implement a Stack using Linked List

In our previous code, we have seen how to write a C program to implement a stack. Today we will learn how to implement stack using Linked Lists. C Program to Implement a Stack using Linked List : This C Program implement a stack using linked list. Stack is a type of queue that in practice is implemented as an...