- 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 7347 Articles for C++
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
1K+ Views
Suppose the string is like " IWANTTOLEARNCODE". This string is written in a zigzag way on a given number of rows say n. So the pattern is looking like thisITAOWNOERCDALNEWhen we read the line like − "ITAOWNOERCDALNE"So we have to create one module that can perform this kind of operation by taking the string and the number of rows.To solve this, we will follow these stepswhen n = 1, then return screate an array of strings arr of size nrow := 0, and down := truefor i in range 0 to size of string – 1insert s[i] at the end ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
348 Views
Binomial Heap is defined as an extension of Binary Heap that provides faster merge or union operation together with other operations provided by Binary Heap.A Binomial Heap is treated as a collection of Binomial Trees.What is a Binomial Tree?A Binomial Tree of order k can be built by taking two binomial trees of order k-1 and treating one as leftmost child or other.A Binomial Tree of order k has below properties.The number of nodes of Binomial Tree has exactly 2k.The depth of Binomial Tree is k.There are exactly kCi nodes at depth i where i = 0, 1, . . ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
557 Views
In case of a given Binary Tree, convert it to a Binary Search Tree in such a way that keeps the original structure of Binary Tree intact.Sets of C++ STL will be used by this solution instead of array based solution.ExamplesExample 1Input 11 / \ 3 8 / \ 9 5Output 9 / \ 5 11 / \ 3 8Example 2Input 11 / \ 31 16 / \ 21 ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
582 Views
2’s Complement Number System is widely implemented in computer architecture.N-bit 2’s Complement number System can be able to represent Number from -2n-1 to 2n-1- 14 Bit can be able to represent numbers from ( -8 to 7 )5 Bit can be able to represent numbers from ( -16 to 15 ) in 2’s Complementary System.Overflow happens with respect to addition when 2 N-bit 2’s Complement Numbers are appended and the answer is too large to fit into that N-bit Group.A computer contains N-Bit Fixed registers. Result of addition of two N-Bit Number will result maximum N+1 Bit number.Carry Flag stores ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
282 Views
In case of comparing with a flat array of numbers, the Fenwick tree results a much better balance between two operations: element update and prefix sum computation. In case of a flat array of m numbers, we can either store the elements, or the prefix sums. In case of first instance, calculating prefix sums needs linear time; in case of second instance, modifying or updating the array elements needs linear time (in both instances, the other operation can be accomplished in constant time). Fenwick trees permit both operations to be accomplished in O(log m) time. This is obtained by representing ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
3K+ Views
In case of given m elements of different weights and bins each of capacity C, assign each element to a bin so that number of total implemented bins is minimized. Assumption should be that all elements have weights less than bin capacity.ApplicationsPlacing data on multiple disks.Loading of containers like trucks.Packing advertisements in fixed length radio/TV station breaks.Job scheduling.ExampleInput: weight[] = {4, 1, 8, 1, 4, 2} Bin Capacity c = 10 Output: 2 We require at least 2 bins to accommodate all elements First bin consists {4, 4, 2} and second bin {8, 2}Lower BoundWe can always calculate a lower ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
203 Views
The Barabási-Albert model is treated as one of several proposed models that produce scale-free networks. It combines two important general concepts: growth and preferential attachment. Both concepts i.e. growth and preferential attachment have wide existence in real networks. The meaning of growth is that the number of nodes in the network increases over time.The meaning of preferential attachment is that the more connected a node is, the more chance it is to receive new links.Higher degree nodes have stronger ability to catch or grab links added to the network. Basically, the preferential attachment can be well understood if we think ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
133 Views
In this technique, we transfer the nodes having vowels as keys to the beginning and consonants to the end. In this case we also maintain the order. Example is given below −Input: A-M-A-Z-O-N Output: A-A-O-M-Z-N Code (Complexity: O(N), Space O(1))Example Live Demo#include using namespace std; class Node1{ public: char var1; Node1 *next1; Node1(char v, Node1 *next1=NULL):var1(v), next1(next1){} }; Node1 *make_list(char array1[], int size1){ if(size1 ==0) return NULL; else { Node1 *head = new Node1('o'); Node1 *temp = head; for(int i=0;inext1 = new Node1(array1[i]); ... Read More