Here, we are given a linked list and an index. We have to write a function to get Nth node in a linked list.Let’s take an example to understand the problem, Inputlinked list = 34 -> 4 -> 9 -> 1 , n = 2Output9To go to the node specified by n. We will go node by node in the linked list and increase the index count until the required nth position is reached.Program to illustrate the program, Example Live Demo#include using namespace std; class Node{ public: int data; Node* next; }; void insertNode(Node** head_ref, int new_data) ... Read More
Write a program that compiler and runs both in c and c++ and produces different results.There are multiple types of programs that give different results when compiled in c and c++.i. Using character literals− c and c++ both treat characters differently. In C, they are treated as integer literals whereas, in C++, they are treated as characters.Example Live Demo#include int main(){ printf("%d", sizeof('a')); return 0; }OutputC : 4 C++: 1ii. Use of binary number − binary values are not considered as binary in c, instead treat it as integer. But in c++, they are treated as binary.Example Live Demo#include int ... Read More
In this problem, we are given two integers x and n. Our task is to write a program to calculate the pow(x,n). Let's take an example to understand the problem, Input: x = 5 , n = 3 Output: 125 Example Program to calculate the pow(x,n): #include using namespace std; float myPow(float x, int y) { if (y == 0) return 1; float temp = myPow(x, y / 2); if (y % 2 == 0) return temp * temp; else { if (y > 0) return x * temp * temp; else return (temp * temp) / x; } } int main() { float x = 5; int n = 7; cout
In this problem, we are given a tree and our task is to create a program to calculate the size of the tree using recursion.The size of a tree is the total number of nodes present in the tree.Let’s take an example to understand the problem, The size of the above tree is 5.To find the size of the tree, we will have to add the size of left subtree and right subtree and then increment it by 1. The recursive function will be called for both left and right subtrees of the tree. And if no subtree is found ... Read More
In this problem, we are given a binary tree. Our task is to write a program to find the maximum depth or height of the given tree.Let’s take an example to understand the problem, The height of the tree is 3.To find the maximum height of a tree, we will check the heights of its left and right subtree and add one to the maximum of both. This is a recursive process that will continue this the last node is of the tree is found and one is added progressively to find the height of the sub-trees.Above example solved using ... Read More
Here, we are given an array or a string of characters. We will create a program to reverse the elements of an array or string.Let’s take an example to understand the problem, Inputarray = {2, 5, 7, 1, 9}Output{9, 1, 7, 5, 2}Inputstring = “Hello!”Output!0lleHTo create a program, we will loop through the elements of the array/string(both work in the same way). Taking one variable for start and one of end. And swap both elements. Increment the start variable and decrement the end variable. The swapping will continue till start variable’s value is less than end variable.The program can be ... Read More
Before Java 9, we have to search in google to find out particular packages, class, interface, and method information. Since Java 9, Javadoc includes search options in the API documentation itself, and the output is HTML5 compliant.In the below example, we have created the "JavaDocTest.java" file in the "C:/JAVA" folder.Examplepublic class JavaDocTest { /** * Default method to be run to print * Tutorialspoint * @param args command-line arguments */ public static void main(String args[]) { System.out.println("Tutorialspoint"); } }The documentation generated by Java 9 ... Read More
Implementation of FizzBuzz involves printing numbers from 1 to 100. If the numbers are multiples of 3 then Fizz is printed. If they are multiples of 5, then Buzz is printed and if they are multiples of both 3 and 5 then FizzBuzz is printed.A program that demonstrates the implementation of FizzBuzz is given as follows.Example Live Demousing System; namespace FizzBuzzDemo { public class example { static void Main(string[] args) { for (int i = 1; i
This article poses a common advisory and security measure note for the Zoom users to protect themself from presumptive hacking attempt, as this application is quite vulnerable to breach. Zoom is quite trending and its popularity mysteriously skyrocket in last 3 month in terms of downloads (20 CR) despite having other plethora of amazing video conferencing application. Zoom does not have the End-to-end encryption facility like whatsapp and WebEx and attackers can potentially gain control to the ZOOM without its user’s cognizance by mean of a secret tools called zWarDial.However, I am not going to discuss the usage of this ... Read More
This article is intended to demonstrate, how to bypass the anti-virus detection using the Veil framework, as it is a collection of tools designed for use during penetration testing. It currently consists of the following modules −Veil-Evasion − a tool to generate antivirus-evading payloads using a variety of techniques and languagesVeil-Catapult − a psexec-style payload delivery system that integrates Veil-EvasionVeil-PowerView − a powershell tool to gain network situational awareness on Windows domainsVeil-Pillage − a modular post-exploitation framework that integrates Veil-EvasionRequirementsTo install the Veil- Framework, you are supposed to configure the latest Python packages into your machine.How to InstallThe important point ... Read More