Sudhir sharma has Published 1218 Articles

Abundant Number in C ?

sudhir sharma

sudhir sharma

Updated on 07-Aug-2019 14:44:39

2K+ Views

An abundant Number (also known as excessive number) is a number in the number theory which itself is smaller than the sum of all its proper divisors. For example, 12 is an abundant Number : divisors 1, 2, 3, 4, 6 , sum =16 >12.The difference between the sum of ... Read More

abs() function for complex number in c++ ?

sudhir sharma

sudhir sharma

Updated on 07-Aug-2019 14:41:04

343 Views

The abs function in C++ is used to find the absolute value of a complex number. The absolute value of a complex number (also known as modulus) is the distance of that number from the origin in the complex plane. This can be found using the formula −For complex number ... Read More

A shorthand array notation in C for repeated values?

sudhir sharma

sudhir sharma

Updated on 07-Aug-2019 14:38:32

122 Views

An array stores number of same data type. For an array there may arise a situation when you need to store 2-3 values that are same i.e. 3, 3, 3, 3 needs to be stored.For this case, the programing language C has made a simple way to create an array ... Read More

A program to check if a binary tree is BST or not in C ?

sudhir sharma

sudhir sharma

Updated on 07-Aug-2019 14:32:47

199 Views

A binary tree is a tree data structure in which there are two child nodes for each node. The child nodes being two are referred as, left and right child.A BST is a tree structure in which left subtree contains nodes with values lesser than root and right subtree contains ... Read More

A modified game of Nim in C ?

sudhir sharma

sudhir sharma

Updated on 07-Aug-2019 14:32:16

429 Views

Modified game of Nim is an optimisation games of arrays. This game predicts the winner based on the starting player and optimal moves.Game Logic − In this game, we are given an array{}, that contains elements. There are generally two players that play the game namly player1 and player2. The ... Read More

0-1 Knapsack Problem in C?

sudhir sharma

sudhir sharma

Updated on 07-Aug-2019 14:24:15

20K+ Views

A knapsack is a bag. And the knapsack problem deals with the putting items to the bag based on the value of the items. It aim is to maximise the value inside the bag. In 0-1 Knapsack you can either put the item or discard it, there is no concept ... Read More

Program to calculate the area of a Tetrahedron

sudhir sharma

sudhir sharma

Updated on 06-Aug-2019 06:46:49

91 Views

A tetrahedron is a pyramid with triangular base i.e. it has a base that is a triangle and each side has a triangle. All the three triangles converge to a point. As in the figure, Area of Tetrahedron = (√3)a2ExampleThe code to find the area of tetrahedron uses the math ... Read More

Program to build DFA that starts and ends with ‘a’ from the input (a, b)

sudhir sharma

sudhir sharma

Updated on 06-Aug-2019 06:41:47

532 Views

DFA stands for Deterministic Finite Automata. It is a finite state machine that accepts or a string based on its acceptor.Here, we are going to make a DFA that accepts a string that starts and ends with a. The input is from the set (a, b). Based on this we ... Read More

Advertisements