Binary Search Program, Algorithm & their Time Complexity. In this tutorial, You’ll learn about binary search algorithm, how it’s useful in searching and the time complexity of a binary search.
A Binary Search is used to search an element in a sorted array. Binary search is also known as half-interval search or logarithmic search. It works by comparing a value (value needs to search) to the middle element an array. If a value matches with the middle element then the position 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)).
Write a program to print middle element of a linked list. It is also the most asked question in interviews. I assume you have a basic understanding of linked list and it’s concept.
Implement a stack data structure in C, C++ using an Array. In this post, We’ll learn about stack data structure and it’s implementation using an array.
Stack data structure implementation using Linked List.
What is Stack
A Stack is a Data Structure, in which insertion and deletion operations are allowed only at one end. It worked on LIFO (Last In First Out) Principle. In LIFO, the element which inserted last must be the first element to be removed.
Write a selection sort program in C. How selection sort algorithm works and what’s their time complexity.
What is Selection Sort
Selection sort is an in-place comparison sort. Like bubble sort time complexity of Selection sort is also O(n^2). It is not suitable for large elements.