Prateek Jangid has Published 190 Articles

Largest BST in a Binary Tree in C++

Prateek Jangid

Prateek Jangid

Updated on 07-Mar-2022 07:35:19

348 Views

In a binary tree, there are only two nodes (left and right) in each child node. Tree structures are simply representations of data. Binary Search Trees (BSTs) are special types of Binary Trees that meet these conditions −Compared to its parent, the left child node is smallerThe parent node of ... Read More

Kruskal's Minimum Spanning Tree Algorithm-Greedy algorithm in C++

Prateek Jangid

Prateek Jangid

Updated on 07-Mar-2022 07:27:02

3K+ Views

A spanning tree is a linked and undirected graph subgraph that connects all vertices. Many spanning trees can exist in a graph. The minimum spanning tree (MST) on each graph is the same weight or less than all other spanning trees. Weights are assigned to edges of spanning trees and ... Read More

Reverse Alternate K Nodes in a Singly Linked List in C++

Prateek Jangid

Prateek Jangid

Updated on 07-Mar-2022 07:02:41

224 Views

In this tutorial, we are given a linked list A of length N and an integer K. We have to reverse alternate pairs of nodes with the size of each pair as K. It is also given that N is divisible by K. First argument is the head pointer of ... Read More

Number of substrings divisible by 8 and not by 3 in C++

Prateek Jangid

Prateek Jangid

Updated on 07-Mar-2022 06:52:37

129 Views

A string of 0-9 is given. For this problem, we need to calculate the number of strings that are divisible by 8 and not by 3. This is a 2 step problem, and we need to do the code one step at a time to solve it, for exampleInputstr = ... Read More

Number of Substrings divisible by 6 in a String of Integers in C++

Prateek Jangid

Prateek Jangid

Updated on 07-Mar-2022 06:47:16

221 Views

We'll look at a problem in which we're given an integer string and must determine how many substrings are divisible by 6 in integer format. It should be noted that input is in the form of a String made of numbers (integers). Still, the divisibility check will be performed considering ... Read More

Passing the Assignment in C++

Prateek Jangid

Prateek Jangid

Updated on 07-Mar-2022 06:33:34

86 Views

In this tutorial, we have to write an algorithm to find a way to pass an assignment without being caught by the invigilator. Each student has to submit their assignment to the invigilator. Student A's assignment is with Student B, so Student B has to return/pass the assignment to Student ... Read More

What are Alternative Ways to Reverse a String from Shell?

Prateek Jangid

Prateek Jangid

Updated on 29-Nov-2021 10:51:44

412 Views

In the Linux shell, we have predefined commands to return a reversed string. Anyone can use these commands for reversing an output of the program.Perl CommandIt is a general-purpose programming language in Linux.Inputperl -ne 'chomp;print scalar reverse . "";'

How to Reverse a String using Unix Shell Programming?

Prateek Jangid

Prateek Jangid

Updated on 29-Nov-2021 10:46:19

8K+ Views

Bash is a shell or command line interpreter. It is a layer programming language that understands and executes the command that a user enters or can read commands from a script. Essentially Bash or Shell allows users of Unix-like systems and Windows via a Windows subsystem for Linux to control ... Read More

Reverse a Linked List using C++

Prateek Jangid

Prateek Jangid

Updated on 29-Nov-2021 10:39:35

2K+ Views

In this article, we need to reverse the links with the help of a singly linked list. Our task is to create a function that is capable of reversing the given singly linked list. For exampleInput: Following Linked list : 1->2->3->4->NULL Output: After processing of our function: 4->3->2->1->NULLApproach to ... Read More

Reverse a Linked List in groups of a Given Size using C++

Prateek Jangid

Prateek Jangid

Updated on 29-Nov-2021 10:30:28

171 Views

In this article, we deal with a singly linked list, and the task is to reverse the list in groups of k. For example −Input: 1->2->3->4->5->6->7->8->NULL, K = 3 Output: 3->2->1->6->5->4->8->7->NULL Input: 1->2->3->4->5->6->7->8->NULL, K = 5 Output: 5->4->3->2->1->8For this problem, one approach that comes to mind is trailing the ... Read More

Previous 1 ... 5 6 7 8 9 ... 19 Next
Advertisements