Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C++ Articles - Page 663 of 719
4K+ Views
What is Adjacency Matrix? Adjacency matrix is a square matrix that represent a finite graph data structure using a 2D array. The each elements in the matrix represent the edges of the graph. For example, if the graph has some edges from i to j vertices, then in the adjacency matrix at ith row and jth column it will be 1 (or some non-zero value for weighted graph), otherwise that place will hold 0. Graph The image below represent a simple undirected graph with 6 vertices and 8 edges. Adjacency Matrix The adjacency matrix of the ... Read More
2K+ Views
The merge sort technique is based on the divide-and-conquer technique. We divide the whole data set into smaller parts and merge them into a larger piece in sorted order. It is also very effective for worst cases because this algorithm has lower time complexity for worst cases too. A linked list can be sorted using merge sort very efficiently. For the linked list, the merging task is very simple. We can simply update the links to merge them. In this article, we have an unsorted linked list. Our task is to sort the given unsorted list using the merge ... Read More
464 Views
The quicksort technique is done by separating the list into two parts. Initially a pivot element is chosen by partitioning algorithm. The left part of the pivot holds the smaller values than pivot, and right part holds the larger value. After partitioning, each separate lists are partitioned using same procedure.Here we are considering a large array (nearly 100 elements) to sort. We are taking some numbers then shuffling them in randomized order to make them unsorted. Then sort using quicksort technique.The complexity of Quicksort TechniqueTime Complexity − O(n log n) for best case and average case, O(n2) for worst case.Space ... Read More
380 Views
To sort less than 100 numbers in O(N) complexity, we can use the counting sort technique. The counting sort is a stable and non-comparison-based sorting technique, that is used to sort the objects according to the keys that are small integers. It counts the number of keys whose key values are same. It works by counting the occurrences of elements in the array. This sorting technique is efficient when difference between different keys are not so big, otherwise it can increase the space complexity. In this article, we have an unsorted array containing twelve elements. Our task is to sort ... Read More
4K+ Views
The quick sort technique is based on partitioning of array of data into smaller arrays. Initially, a pivot element is chosen by the partitioning algorithm. The left part of the pivot holds smaller values than the pivot, and the right part holds the larger value. In this case, we are choosing the pivot element randomly. After choosing the pivot, we do the partitioning and then sort the array recursively. In this article, we have an array having 100 elements. Our task is to implement quick sort on this array using randomization in C++. Here is an example of a quick ... Read More
3K+ Views
The Fibonacci numbers, commonly denoted as F(n) forms a sequence, called the Fibonacci sequence. In Fibonacci series, each number is the sum of the two previous two numbers, starting from 0 and 1. It is represented as F(n) = F(n-1) + F(n-2). The matrix exponentiation method is used to calculate the powers of matrix efficiently with better time complexity. In this article, we provide a value of n. This n is the value up to which we want to find the Fibonacci numbers using the matrix exponentiation method in C++. Here is an example of the Fibonacci series up to ... Read More
935 Views
Fast Fourier transform (FFT) is an algorithm to compute the discrete Fourier transform (DFT) and its inverse. Basically Fourier analysis converts time (or space) to frequency and vice versa. A FFT rapidly computes transformations by factorizing the DFT matrix into a product of sparse (mostly zero) factors.AlgorithmBegin Declare the size of the array Take the elements of the array Declare three arrays Initialize height =size of array and width=size of array Create two outer loops to iterate on output data Create two outer loops to iterate on input data Compute real, img and ... Read More
3K+ Views
DFT stands for Discrete Fourier Transform. DFT is a mathematical technique in which we convert the signals of the time domain to their respective signal in the frequency domain, i.e., converting into a list of numbers that tell us which frequencies are present in that signal. Here, by time signal, we mean signals such as audio, temperature, etc that changes over time. The frequency signal means the frequency of each signal present in the time signal. The numbers that tell us which frequencies are present in the signal are called the coefficients. In this article, our task is to compute ... Read More
338 Views
DFT stands for Discrete Fourier Transform. DFT is a mathematical technique in which we convert the signals of the time domain to their respective signal in the frequency domain, i.e., converting into a list of numbers that tell us which frequencies are present in that signal. Here, by time signal, we mean signals such as audio, temperature, etc. that changes over time. The frequency signal means the frequency of each signal present in the time signal. The numbers that tell us which frequencies are present in the signal are called the coefficients. In this article, our task is to compute ... Read More
1K+ Views
The bin packing problem is a special type of cutting stock problem. In the bin packing problem, objects of different volumes must be packed into a finite number of containers or bins each of volume V in a way that minimizes the number of bins used. In computational complexity theory, it is a combinational NP-hard problem.When the number of bins is restricted to 1 and each item is characterized by both a volume and a value, the problem of maximizing the value of items that can fit in the bin is known as the knapsack problem.AlgorithmBegin Binpacking(pointer, size, no ... Read More