Narendra Kumar has Published 191 Articles

Minimization of ER Diagram

Narendra Kumar

Narendra Kumar

Updated on 22-Oct-2019 12:13:03

2K+ Views

Problem statementER diagram is pictorial representation of shows various tables and relations amongst them. ER diagram we can reduce the number of database.One to one cardinalityLet us consider below diagram with one to one cardinality −Above ER diagram represents 3 entities −Employee entity has 2 attributes namely emp_name. emp_id is ... Read More

Minimax Algorithm in Game Theory (Alpha-Beta Pruning) in C++

Narendra Kumar

Narendra Kumar

Updated on 22-Oct-2019 12:09:07

3K+ Views

DescriptionAplha-Beta pruning is a optimization technique used in minimax algorithm. The idea benind this algorithm is cut off the branches of game tree which need not to be evaluated as better move exists already.This algorithm introduces two new fields −Alpha − This is best value(maximum) that maximizer player can guaratee ... Read More

Deep Copy of Struct Member Arrays in C

Narendra Kumar

Narendra Kumar

Updated on 26-Sep-2019 13:44:41

2K+ Views

Structure allows us to create user defined datatype. Structure member can be primitive datatype or it can be an array of statically allocated memory. When we assign one structure variable to another then shallow copy is performed. However, there is an exception, if structure member is an array then compiler ... Read More

Alternating Vowels and Consonants in C/C++

Narendra Kumar

Narendra Kumar

Updated on 26-Sep-2019 13:41:39

371 Views

Given an input string with vowels and consonants. Rearrange the string such a way that vowels and consonants occupies alternate position in final string. As we are arranging vowels and consonants at alternate position the input string must satisfy either of the following conditions −Number of vowels and consonants must ... Read More

C++17 If statement with initializer

Narendra Kumar

Narendra Kumar

Updated on 26-Sep-2019 13:34:49

14K+ Views

C++17 has extended existing if statement’s syntax. Now it is possible to provide initial condition within if statement itself. This new syntax is called "if statement with initializer". This enhancement simplifies common code patterns and helps users keep scopes tight. Which in turn avoids variable leaking outside the scope.ExampleLet us ... Read More

Minimum flips required to maximize a number with k set bits in C++.

Narendra Kumar

Narendra Kumar

Updated on 23-Sep-2019 10:49:41

161 Views

Problem statementGiven two numbers n and k, we need to find the minimum number of flips required to maximize given number by flipping its bits such that the resulting number has exactly k set bits. Please note input must satify condition that k < number of bits in n.ExampleLet us ... Read More

Minimum flips in two binary arrays so that their XOR is equal to another array in C++.

Narendra Kumar

Narendra Kumar

Updated on 23-Sep-2019 10:41:53

201 Views

Problem statementGiven three arrays with 0’s and 1’s of size n, the task is to find minimum flip of bits in the first and second array such that the XOR of i’th index bit of first and second array is equal to i’th index bit of the third array.Please note ... Read More

Minimum element in a max heap in C++.

Narendra Kumar

Narendra Kumar

Updated on 23-Sep-2019 10:34:50

389 Views

Problem statementFind the element with the least value in max heap.Let us consider below max heap.In max heap value of the root node is always greater than its childer. Because of this property, we can conclude that value will be present in one of the leaf nodes. If heap contains ... Read More

Minimum delete operations to make all elements of array same in C++.

Narendra Kumar

Narendra Kumar

Updated on 23-Sep-2019 10:29:22

212 Views

Problem statementGiven an array of n elements such that elements may repeat. We can delete any number of elements from array. The task is to find a minimum number of elements to be deleted from array to make it equal.arr[] = {10, 8, 10, 7, 10, -1, -4, 12}We have ... Read More

Minimum and Maximum Prime Numbers of a Singly Linked List in C++.

Narendra Kumar

Narendra Kumar

Updated on 23-Sep-2019 10:25:58

184 Views

Problem statementGiven a linked list of n positive integers. We have to find the prime number with minimum and maximum value.If the given list is −10 -> 4 -> 1 -> 12 -> 13 -> 7 -> 6 -> 2 -> 27 -> 33 then minimum prime number is 2 ... Read More

Advertisements