Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C++ Articles - Page 464 of 719
751 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
903 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
460 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
4K+ 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
309 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
233 Views
A singly linked list is a fundamental data structure that consists of nodes, where each node contains a data field and a reference to the next node in the linked list. The next of the last node is null, indicating the end of the list. The given task is to rearrange the linked list in such a way that all the vowel nodes precede the consonants while maintaining the order of their arrival. Scenario Input: a -> b-> c -> d-> e-> f-> g-> h-> i Output: a-> e-> i-> b-> c-> d-> f-> g-> h To solve this problem, we ... Read More
1K+ Views
In C++, an array member is simply the individual elements stored within an array. What is Deep Copy? A deep copy creates a new object and allocates separate memory for the dynamically allocated resources; it copies all the data members of the original object into the new object. So that the new object is completely independent of the original. When a class has a pointer to dynamic memory, the default copy constructor and assignment operator will perform a shallow copy, which is a copy of the pointer rather than the data. So, must define our own ... Read More
176 Views
In this problem, we are given a circle whose chord and tangent meet at a particular point. The angle in the alternate segment of a circle is given. We need to find the angle between the chord and the tangent. According to the Alternate Segment Theorem the angle between a chord and a tangent is equal to the angle in the alternate segment of the circle. Chord and Tangent The chord of a circle can be defined as the line segment joining any two points on ... Read More