Arnab Chakraborty has Published 3734 Articles

C++: Methods of code shortening in competitive programming?

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Aug-2019 14:35:42

492 Views

In this section we will see some examples of code shortening strategy for competitive programming. Suppose we have to write some large amount of codes. In that code, we can follow some strategy to make them more short.We can change the type-name to make it short. Please check the code ... Read More

A Space Optimized Solution of LCS in C Program?

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Aug-2019 14:28:42

265 Views

Here we will see one space optimized approach for LCS problem. The LCS is the longest common subsequence. If two strings are “BHHUBC” and “HYUYBZC”, then the length of the subsequence is 4. One dynamic programming approach is already their, but using the dynamic programming approach, it will take more ... Read More

A Peterson Graph Problem in C Program?

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Aug-2019 14:22:04

361 Views

Suppose we have one graph like below. That graph is Peterson graph. The vertices are numbered from 0 through 9. Each vertex has some letters. Let consider one walk W, in that graph, where L vertices are used. A string S with L letters is realized by the walk W ... Read More

A C/C++ Pointer Puzzle?

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Aug-2019 14:15:22

449 Views

Suppose we have one integer variable whose size is 4 byte, another pointer variable is there, whose size is 8 bytes. So what will be the output of the following?Example#include using namespace std; main() {    int a[4][5][6];    int x = 0;    int* a1 = &x;    int** a2 = &a1;    int*** a3 = &a2;    cout

3-digit Osiris number C Program?

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Aug-2019 14:07:54

212 Views

Here we will see the Osiris number. An Osiris number is such kind of number that are equal to the sum of permutations of sub-samples of their own digits. Suppose the number is 132. Then if we calculate {12 + 21 + 13 + 31 + 23 + 32} this ... Read More

C++ program to read file word by word?

Arnab Chakraborty

Arnab Chakraborty

Updated on 13-Aug-2019 10:28:27

5K+ Views

In this section we will see how we can read file content word by word using C++. The task is very simple. we have to use the file input stream to read file contents. The file stream will open the file by using file name, then using FileStream, load each ... Read More

Huffman Coding

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Aug-2019 07:44:26

9K+ Views

Huffman coding is lossless data compression algorithm. In this algorithm a variable-length code is assigned to input different characters. The code length is related with how frequently characters are used. Most frequent characters have smallest codes, and longer codes for least frequent characters.There are mainly two parts. First one to ... Read More

Amortized Complexity

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Aug-2019 06:38:15

4K+ Views

Amortize AnalysisThis analysis is used when the occasional operation is very slow, but most of the operations which are executing very frequently are faster. In Data structures we need amortized analysis for Hash Tables, Disjoint Sets etc.In the Hash-table, the most of the time the searching time complexity is O(1), ... Read More

Asymptotic Notation - O(), o(), Ω(), ω(), and θ()

Arnab Chakraborty

Arnab Chakraborty

Updated on 05-Aug-2019 06:19:15

9K+ Views

Asymptotic NotationsAsymptotic notations are used to represent the complexities of algorithms for asymptotic analysis. These notations are mathematical tools to represent the complexities. There are three notations that are commonly used.Big Oh NotationBig-Oh (O) notation gives an upper bound for a function f(n) to within a constant factor.Little o NotationsThere ... Read More

Asymptotic Complexity

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Aug-2019 10:42:03

5K+ Views

Asymptotic AnalysisUsing asymptotic analysis, we can get an idea about the performance of the algorithm based on the input size. We should not calculate the exact running time, but we should find the relation between the running time and the input size. We should follow the running time when the ... Read More

Advertisements