
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
Found 33676 Articles for Programming

653 Views
C provides libraries for string operations such as the string.h header file that contains a strlen() function, which counts the length of a string. Otherwise, a loop can be used to count the string length. There are also different ways to find the length of a string apart from the above two methods. So, basically, in this article, we will learn how to find the length of a string without string.h and loop in C. Find Length of a String Without string.h and Loop in C There are the following ways to find the string's length without using the string.h ... Read More

3K+ Views
std::string The std::string is a class of C++ Standard Library (STL) that represents a string (sequence of characters). It is used to handle strings with better memory management, i.e., it provides dynamic memory management for strings and supports a rich set of in-built functions for string manipulation. Syntax Following is the syntax of string: string str = "tutorialspoint"; std::LPCWSTR The LPCWSTR stands for Long Pointer to Constant Wide STRing. It is a constant string of 16-bit Unicode characters, which may be null-terminated. It is the same as a string but with wide characters. Syntax Following is the syntax of ... Read More

4K+ Views
std::string The std::string is a class of C++ Standard Library (STL) that represents a string (sequence of characters). It is used to handle strings with better memory management, i.e., it provides dynamic memory management for strings and supports a rich set of in-built functions for string manipulation. Syntax Following is the syntax of string: string str = "tutorialspoint"; std::LPCSTR LPCSTR stands for Long Pointer to Constant String. It is a constant, null-terminated string of ANSI (narrow) characters (8-bit characters). In contrast to LPCWSTR, which stores wide characters (Unicode/UTF-16), LPCSTR is used in Windows API functions to store regular char-based ... Read More

363 Views
A histogram is a visual representation of the distribution of quantitively data. You are given a histogram represented by an array arr [], Where each of the array's elements represents the height of the bar in the histogram. All the bars have unit width, i.e., 1 unit. Your task is to determine the largest rectangle area possible in a given histogram, where the largest rectangle is made up of several consecutive bars with heights displayed in an array. Input / Output Scenario Let's understand the below input-output scenario with a diagram: Input: arr[] = [40, 10, 20, 50, 60, 30] ... Read More

176 Views
Here is a C++ Program to implement First Fit Decreasing for 1-D objects and M binsRequired functions and pseudocode:Begin function binPack() returns number of bins required. Initialize binC = 0 Initialize an array to store binVal. Place items one by one. function sort() to perform bubble sort in the descending order. EndExample Code#include using namespace std; void binPack(int *a, int s, int n) { int binC = 0; int binVal[n]; for (int i = 0; i < n; i++) binVal[i] = s; for (int i = 0; i < ... Read More

4K+ Views
This is a C++ Program to Implement the Edmonds-Karp algorithm to calculate maximum flow between source and sink vertex.Algorithm:Begin function edmondsKarp() : initiate flow as 0. If there is an augmenting path from source to sink, add the path to flow. Return flow. EndExample Code#include #include #include #include #include using namespace std; int c[10][10]; int flowPassed[10][10]; vector g[10]; int parList[10]; int currentPathC[10]; int bfs(int sNode, int eNode)//breadth first search { memset(parList, -1, sizeof(parList)); memset(currentPathC, 0, sizeof(currentPathC)); queue q;//declare queue vector q.push(sNode); parList[sNode] = -1;//initialize parlist’s ... Read More

601 Views
This is a C++ Program to implement Network_Flow problem using Ford Fulkerson algorithm.Algorithms:Begin function bfs() returns true if there is path from source s to sink t in the residual graph which indicates additional possible flow in the graph. End Begin function fordfulkarson() return maximum flow in given graph: A) initiate flow as 0. B) If there is an augmenting path from source to sink, add the path to flow. C) Return flow. EndExample Code#include #include #include #include #define n 7 using namespace std; bool bfs(int g[n][n], int s, int ... Read More

3K+ Views
A Binary Search Tree is a sorted binary tree in which all the nodes will have following properties−The right sub-tree of a node has a key greater than to its parent node's key.The left sub-tree of a node has a key lesser than to its parent node's key.All key values are distinct.Each node cannot have more than two children.Class Descriptions:Begin class BST to declare following functions: search() = To search an item in BST. initialize temp = root; while(temp != NULL) Increase ... Read More

181 Views
According to the problem statement, we have a directed graph and two vertices that are source s and destination/target t. Our task is to determine the maximum number of edge-disjoint paths that can be found from vertex s to vertex t. If two paths do not share any edge, then it is known as an edge-disjoint. A directed graph is a digraph where edges have a specific direction. They point from one vertex to another. There can be a maximum two-edge disjoint path from source 0 to destination 7 in the above graph. ... Read More

834 Views
Here is a C++ Program to Perform Greedy ColoringAlgorithm:Begin Take the number of vertices and edges as input. Create function greedyColoring() to assign color to vertices: A) Assign the first color to first vertex. B) Initialize the remaining vertices. C) Declare a temporary array to store the available colors. D) Assign color to the remaining vertices. Print the solution. EndExample Code#include #include using namespace std; int n,e,i,j; vector g; vector col; bool visit[1001]; void greedyColoring() { col[0] = 0; for (i=1;i