Sudhir sharma has Published 1206 Articles

A shorthand array notation in C for repeated values?

sudhir sharma

sudhir sharma

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

129 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

232 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

475 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

22K+ 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

101 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

613 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