Sudhir sharma has Published 1206 Articles

Written version of Logical operators in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 12:38:22

86 Views

In c++ programming language, there are keywords that can be used in place of logical operators. The keywords are initially used in c when the keyboards didn’t support symbols like &&, !, ||, etc. Now, here are some written version of logical operators in c++.Operators and their written versions are ... Read More

XOR of all elements of array with set bits equal to K in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 12:36:26

207 Views

In this problem, we are given an array of n elements and an integer value k. Our task is to find XOR of all elements of the array that have set bits equal to k.Let’s take an example to understand the problem, Inputarray = {2, 12, 44, 103, 17} , ... Read More

XOR Cipher in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 12:28:55

3K+ Views

XOR cipher or XOR encryption is a data encryption method that cannot be cracked by brute-force method.Brute-force method is a method of random encryption key generation and matching them with the correct one.To implement this encryption method, we will define an encryption key(random character) and perform XOR of all characters ... Read More

XOR of a subarray in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 12:14:06

83 Views

In this problem, we are given an arr[] and some queries that are range between L to R in the array. Our task is to print the XOR of the subarray between L to R.Let’s take an example to understand the problem, Input − array = {1, 4, 5, 7, ... Read More

Z algorithm (Linear time pattern searching Algorithm) in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 11:26:30

960 Views

Z algorithm is used to find the occurrence of a pattern in a string in linear time. Suppose if the length of the string is n and the size of the pattern to be searched is m, the time taken to solve will be of the order O(m+n).The z-algorithm uses ... Read More

Z-Buffer or Depth-Buffer method in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 11:20:45

1K+ Views

The z-buffer also known as depth-buffer is a method that is used for hidden surface detection.Hidden surface detectionFor any picture that has objects and surfaces that are transparent. In this case, objects that are behind other objects are hidden. For proper visual of the image, we need to remove these ... Read More

Zero Initialization in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 11:18:30

770 Views

Zero initialization is setting the initial value of an object in c++ to zero.SyntaxT{} ; char array [n] = “”;The situations in which zero initialization are performed are −Named variable with static or thread-local storage is initialized to zero.It is used as initialization of values for non-class types and members ... Read More

Zig Zag Level order traversal of a tree using single queue in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 11:15:53

182 Views

In this problem, we are given a binary tree. Our task is to print the zigzag level order traversal of the tree. For this traversal, we will use a single queue only.Let’s take an example to understand the problem, Output −3    1    7    2    8   ... Read More

Zigzag (or diagonal) traversal of Matrix in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 11:11:01

1K+ Views

In this problem, we are given a 2D matrix. Our task is to print all the elements of the matric in a diagonal order.Let’s take an example to understand the problem, 1    2    3 4    5    6 7    8    9Output −1 4    2 ... Read More

ZigZag Tree Traversal in C++

sudhir sharma

sudhir sharma

Updated on 17-Apr-2020 11:05:47

445 Views

In this problem, we are given a binary tree. Our task is to print the binary tree in a zigzag form.Let’s take an example to understand the problem, The zigzag traversal of the above binary tree is3    5    1    8    7    0    4To solve ... Read More

Advertisements