Binary Search Program in C

Write a code to implement binary search program in c. Given a sorted array, we have to write a code to search an element in an array using binary search.

Binary Search

A Binary Search is used to search an element in a sorted array.  In binary search, we first calculate the mid position of an array.  Then, After that we compare element to be search to the middle element an array. If a value matches with the middle element then the index is returned otherwise the algorithm repeats if the value is less than or greater than the middle element.

A Binary search algorithm is efficient than the linear search algorithm. The time complexity of binary search is O(log(n)). 

Queue Data Structure Implementation Using an Array

Write a program to implement a queue using an array.  In this tutorial, You are going to learn about Queue data structure and their implementation using an array in C, C++ & Java. In my previous posts, I have explained Stack and Linked List data structure.

Queue Data Structure

In Queue data structure, An element is inserted at one end called rear and deleted at other end called front. As compared to stack data structure in which insertion and deletion are allowed only at one end. Queue data structure is also called FIFO (First In First out).