- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1862 Articles for Data Structure
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
61 Views
In this problem, we require to remove all zeros from the given binary string. Also, we require to remove pair of consecutive zeros at once and count the total number of pairs of zeros removal. We can solve the problem by counting the number of pairs of consecutive zeros in the given string. In this tutorial, we will learn two different solutions to solve the problem. Problem statement − We have given circular binary string str of length N. We need to find the minimum number of consecutive zeros required to remove all zeros from the string. Sample Examples Input ... Read More
![Someswar Pal](https://www.tutorialspoint.com/assets/profiles/644125/profile/60_1440932-1682316355.jpg)
168 Views
Introduction In data structures, one of the most important problems is to find a node in a tree where all lines from that node to the leaf nodes have the same color. This topic looks at how graph theory and depth-first search methods can be used to find these nodes quickly. By using a color-coding method and looking at how it affects tree traversal, this problem can teach us a lot about the real world and help us make tree-related processes more efficient. Graph Theory Fundamentals Graph theory is one of the most important ideas in computer science and math. ... Read More
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
80 Views
Here, we require to manipulate the binary string so that it doesn’t contain any consecutive zeros. If we find consecutive zeros, we need to change any zero to 1. So, we require to count the total number of 0 to 1 conversion we should make to remove all consecutive zeros from the string. Problem statement − We have given a binary string ‘str’ containing only 0 and 1. We require to find the minimum number of flips required so that the resultant string doesn’t contain any consecutive zeros. Sample Examples Input – 0101001 Output – 1 Explanation ... Read More
![Someswar Pal](https://www.tutorialspoint.com/assets/profiles/644125/profile/60_1440932-1682316355.jpg)
56 Views
Introduction The introduction to the Java Program to Optimize Wire Length in Electrical Circuit provides a comprehensive overview of the optimization of electrical circuits. It emphasizes the importance of optimizing the wire length in circuit design. The primary goal of the Java program is to develop an algorithm that intelligently minimizes wire lengths, thereby minimizing power consumption and signal interference Understanding Electrical Circuits An electrical circuit has important parts like resistors, capacitors, inductors, diodes, transistors, and switches. The section shows how they work, how they behave, what their symbols mean, and what role they play in how current flows. Circuit ... Read More
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
165 Views
In this problem, we require to find the longest non-increasing subsequence of the given string. The meaning of non-increasing is either character should be the same or in decreasing order. As binary string contains only ‘0’ and ‘1’, the resultant string should start with ‘1’ and end with ‘0’, or start and end with either ‘0’ or ‘1’. To solve the problem, we will count prefix ‘1’s and suffix ‘0’ at each position of the string and find the maximum sum of prefix ‘1’s and suffix ‘0’s. Problem statement − We have given binary string str. We need to ... Read More
![Someswar Pal](https://www.tutorialspoint.com/assets/profiles/644125/profile/60_1440932-1682316355.jpg)
134 Views
Introduction Arthur Cayley came up with Cayley's Formula in the middle of the 19th century. It is one of the most important results in combinatorics and group theory. It says that every finite group can be shown as a permutation group on its own elements. Counting spanning trees in both depend on this idea. Permutations and Groups Understanding Permutations and Groups −Permutations are unique arrangements of elements, important in combinatorics. A group is a structure in algebra that has certain features. Permutation groups are subsets of the symmetric group. They are very useful for learning about abstract mathematics. Key ... Read More
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
70 Views
In this problem, we need to find the longest subset containing at most A 0s and B1s. All we need to do is find all possible subsets using the array elements and find the longest subset containing maximum A 0s and B1. In this tutorial, first, we will learn the recursive approach to solve the problem. After that, we will optimize the code using the dynamic programming approach. Problem statement − We have given an array containing N binary strings. Also, we have given A and B integers. We need to make the longest subset using the given binary strings ... Read More
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
88 Views
In this tutorial, we require to construct a binary string of length K such that it should contain ‘1’ at the ith index if a subset-sum equal to I is possible using array elements. We will learn two approaches to solving the problem. In the first approach, we will use a dynamic programming approach to check whether the subset sum equal to index ‘I’ is possible. In the second approach, we will use a bitset to find all possible sums using array elements. Problem statement − We have given an array containing N integers. Also, we have given integer M ... Read More
![Someswar Pal](https://www.tutorialspoint.com/assets/profiles/644125/profile/60_1440932-1682316355.jpg)
2K+ Views
Introduction Breadth-First Traversal (BFS) is a graph traversal technique that begins at a source cell and moves outward, layer by layer, to reach all nodes in a 2D array. It visits nodes in order of their distance from the source, beginning with the closest ones and working its way outward. In unweighted graphs, BFS guarantees that there is a shortest path to every reachable cell. To successfully apply BFS to a 2D array, it is necessary to have a firm grasp of what is a 2D array. In computer science, a grid, map, or maze can be represented as a ... Read More
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
77 Views
In this problem, we need to split the given string in such a way that the third substring can be a substring of the first two substrings. Let’s think about the solution. The third string can be a substring of the first two string only if the first two string contains all characters of the third string. So, we need to find at least one character in the given string with a frequency of more than 3, and we can take the third substring of the single character. Problem statement − We have given a string str containing the N ... Read More