## C++ Program to Compare Binary and Sequential Search

«

C++ Program to Compare Binary and Sequential Search. Problem Description 1. Implement both binary and sequential search. 2. The time complexity of Binary search is O(log(n)). 3. The time complexity of Linear search is O(n). Problem Solution 1. Implement the binary search and count the number of iteration to compute the result. 2. Implement the … Read more

advertisement

## C++ Program to Implement Counting Sort

«

This is a C++ program to sort the given data using Counter Sort. Problem Description 1. Counter sort implements on a given finite range (k) of the integers. 2. It counts the occurrence of each element. 3. Since it maintains the counter of each integer in the range space complexity is O(k). 4. The time … Read more

advertisement

## C++ Program to Perform Searching Using Self-Organizing Lists

«

C++ Program to implement Self-Organizing List. Problem Description 1. Self-Organizing list updates on the basis of last searched item. 2. The sequential searching approach is used. 3. In general search, 80% time only specific 20% of data is accessed. 4. This algorithm shifts the more important data to the beginning of the list. 5. The … Read more

advertisement

## C++ Program to Implement a Binary Search Algorithm for a Specific Search Sequence

«

C++ Program to find a search sequence using Binary search. Problem Description 1. Implement binary search to find the existence of a search sequence in an array. 2. The time complexity of Binary search is O(log(n)). Problem Solution 1. Implement the binary search to find the first value of search sequence. 2. If it is … Read more

advertisement

## C++ Program to Search for an Element in a Binary Search Tree

«

C++ Program to Search for an Element in a Binary Search Tree. Problem Description 1. Implement binary search to find the existence of a search sequence in a binary search tree. 2. The worst case time complexity of Binary search is O(n) but for the average case, it is O(log(n)). Problem Solution 1. Construct binary … Read more

advertisement

## C++ Program to Find k Numbers Closest to Median of S, Where S is a Set of n Numbers

«
»

This is a C++ Program to find k numbers closest to the median of S, Where S is a set of n numbers. Problem Description 1. We need to find k numbers which have a minimum difference with the median of the data set. 2. It includes sorting using quick sort and then printing k … Read more

advertisement

## C++ Program to Perform Searching Based on Locality of Reference

«
»

C++ Program to perform Searching Based on Locality of Reference. Problem Description 1. Searching based on Locality of Reference and also called Principle of locality. 2. According to this principle, depending on the memory access pattern data elements are reallocated. 3. In general search, 80% time only specific 20% of data is accessed. 4. The … Read more

advertisement

## C++ Program to Implement Interpolation Search Algorithm

«
»

C++ Program to implement Interpolation Search. Problem Description 1. It is a better approach for uniform data. 2. Implement binary search using interpolation approach. 3. The time complexity is O(log(n)). Problem Solution 1. Implement the binary search on a sorted array. 2. Calculate mid value using interpolation formula. 3. Exit. Program/Source Code C++ program to … Read more

advertisement

## C++ Program to Find kth Largest Element in a Sequence

«
»

C++ Program to find Kth Largest Element in a Sequence. Problem Description 1. Extract the Kth largest element from a sequence. 2. By selectively sorting the array to get Kth largest element it has the complexity of O(k*n). 2. We can improve the time complexity by approaching the problem using max-heap. 3. The time complexity … Read more

advertisement

## C++ Program to Search Sorted Sequence Using Divide and Conquer with the Aid of Fibonacci Numbers

«
»

C++ Program to Search in Sorted Sequence using Divide and Conquer with the aid of Fibonacci Numbers. Problem Description 1. It implements a Divide and Conquer approach using Fibonacci numbers. 2. Using Fibonacci numbers we calculate mid of data array to search the data item. 3. The time complexity is O(log(n)). Problem Solution 1. Calculate … Read more

advertisement
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn | Youtube | Instagram | Facebook | Twitter