Found 1401 Articles for C

Barabasi Albert Graph (for Scale Free Models) in C/C++?

Arnab Chakraborty
Updated on 29-Jan-2020 11:00:00

203 Views

The Barabási-Albert model is treated as one of several proposed models that produce scale-free networks. It combines two important general concepts: growth and preferential attachment. Both concepts i.e. growth and preferential attachment have wide existence in real networks. The meaning of growth is that the number of nodes in the network increases over time.The meaning of preferential attachment is that the more connected a node is, the more chance it is to receive new links.Higher degree nodes have stronger ability to catch or grab links added to the network. Basically, the preferential attachment can be well understood if we think ... Read More

Arrange a binary string to get maximum value within a range of indices C/C++?

Arnab Chakraborty
Updated on 29-Jan-2020 08:14:40

212 Views

In case of a given string consisting of only 0’s and 1’s, we are given M non-intersecting ranges A, B( A

An application on Bertrandís ballot theorem in C/C++

Arnab Chakraborty
Updated on 29-Jan-2020 07:51:43

123 Views

In Bertrand's original paper, he explains a proof depended on a general formula for the number of favourable sequences implementing a recursion relation.ExampleLet there are 5 voters, of whom 3 vote for candidate A and 2 vote for candidate B (so p = 3 and q = 2). Ten possibilities are exist for the order of the votes cast −AAABBAABABABAABBAAABAABBAABABABAABAABBAABABAABBAAAFor the order AABAB, the tally of the votes as the election progresses is given below −CandidateAABABA12233B00112For each column the tally for A is always greater than the tally for B so the A is always strictly ahead of B. For ... Read More

All combinations of strings that can be used to dial a number in C/C++?

Arnab Chakraborty
Updated on 29-Jan-2020 07:43:50

83 Views

With respect of a given number, display or print all possible combinations of strings that can be implemented to dial the given number in a phone with the help of following pecifications.In the given phone, we can dial, 2 implementing A or B or C, 3 implementing D or E or F, ……………….8 implementing T or U or V, 9 implementing W or X or Y or Z, 1 implementing only 10 implementing 0.For example if 89, is the given phone number, the program should printTW, TX, TY, TZ, UW, UX, UY, UZ, VW, VX, VY, VZ#include #include ... Read More

Some Interesting Observations about C/C++ Ternary Operator

Arnab Chakraborty
Updated on 29-Jan-2020 07:29:59

213 Views

We know that ternary operator is implemented instead of if..else clause. It is denoted by ?: . '?' symbol is equivalent to if part and ':' is equivalent to else part. The following 3 programs explain some interesting observation in case of ternary operator.The following program is able to compile without any error. Ternary expression’s return type is expected to be float (as that of exp2) and exp3 (i.e. literal zero - int type) is able to implicitly convert to float.#include using namespace std; int main(){    int test1 = 0;    float fvalue = 3.111f;    cout

C vs BASH Fork bomb in C/C++?

Arnab Chakraborty
Updated on 29-Jan-2020 07:25:12

330 Views

It is already cleared that the BASH fork bomb is much more powerful than its version of C program. The main cause is that in BASH the created process is detached from the parent. If the parent process (the one we initially started) is destroyed or killed, the remaining or rest of the processes live on. But in case of the C implementation, the listed child processes die automatically if the parent is destroyed or killed. A script is responsible to communicate with the system directly.The fork bomb program in C can be updated or modified. We can be able ... Read More

AA Trees in C/C++?

Arnab Chakraborty
Updated on 29-Jan-2020 07:18:07

940 Views

An AA tree in computer science is defined as a form of balanced tree implemented for storing and retrieving ordered data efficiently. AA trees are treated as a variation of the red-black tree, a form of binary search tree which supports efficient addition and deletion of entries. As opposed to red-black trees, red nodes on an AA tree can only be added as a right subchild, no left subchild. The result of this operation is the simulation of a 2-3 tree instead of a 2-3-4 tree, which causes simplification the maintenance operations. The maintenance algorithms for a red-black tree require ... Read More

A-Buffer Method in C/C++?

Arnab Chakraborty
Updated on 29-Jan-2020 07:07:58

1K+ Views

A-Buffer technique in computer graphics is a simple hidden face detection mechanism used to medium scale virtual memory computers. This technique is also known as anti-aliased or area-averaged or accumulation buffer. This technique extends the algorithm of depth-buffer (or Z Buffer) technique. As the depth buffer technique can only be implemented for opaque object but not for transparent object, the A-buffer technique provides advantage in this scenario. Though the A buffer technique requires more memory, but different surface colors can be correctly composed implementing it. Being a descendent of the Z-buffer algorithm, each position in the buffer can locate or ... Read More

A Number Link Game in C/C++?

Arnab Chakraborty
Updated on 29-Jan-2020 07:04:03

131 Views

The Game − Suppose an n × n array of squares. Out of these, some of the squares are empty, some are solid, and some non-solid squares are set by integers 1, 2, 3, … .Each integer maintains or occupies exactly two different squares on the board. The task of the player is to connect the two occurrences of each integer on the board with the help of a simple path implementing horizontal and vertical movements alone. No two different paths are permitted to intersect one another. No path may include any solid square (solid squares are not permitted to ... Read More

0/1 Knapsack using Branch and Bound in C/C++?

Arnab Chakraborty
Updated on 29-Jan-2020 06:09:36

1K+ Views

The idea is to implement the fact that the Greedy approach provides the best solution for Fractional Knapsack problem.To check whether a particular node can give us a better solution or not, we calculate the optimal solution (through the node) implementing Greedy approach. If the solution calculated by Greedy approach itself is more than the best so far, then we can’t obtain a better solution through the node.Complete Algorithm is given below −Sort all items according to decreasing order of ratio of value per unit weight so that an upper bound can becalculated implementing Greedy Approach.Initialize maximum profit, such as ... Read More

Advertisements