
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 26504 Articles for Server Side Programming

138 Views
In this tutorial, we will be discussing a program to convert all lowercase characters to uppercase whose ASCII value is co-prime with k.For this we will be provided with a string and an integer value k. Our task is to traverse through the given string and change to uppercase all those characters whose ASCII value is co-prime with the given integer k.Example Live Demo#include using namespace std; //modifying the given string void convert_string(string s, int k){ int l = s.length(); for (int i = 0; i < l; i++) { int ascii = (int)s[i]; ... Read More

240 Views
In this tutorial, we will be discussing a program to convert a tree to a forest of even nodes.For this we will be provided with a binary tree of say N nodes. Our task is to calculate the maximum number of edges that can be removed to get forest of even nodes.Example Live Demo#include #define N 12 using namespace std; //returning the number of nodes of subtree //having the root node int depth_search(vector tree[N], int visit[N], int *ans, int node){ int num = 0, temp = 0; //marking nodes as visited visit[node] = 1; for (int i ... Read More

2K+ Views
In this tutorial, we will be discussing a program to convert a string to hexadecimal ASCII values.For this we will be provided with a string of characters. Our task is to print that particular given string into its hexadecimal equivalent.Example Live Demo#include #include //converting string to hexadecimal void convert_hexa(char* input, char* output){ int loop=0; int i=0; while(input[loop] != '\0'){ sprintf((char*)(output+i), "%02X", input[loop]); loop+=1; i+=2; } //marking the end of the string output[i++] = '\0'; } int main(){ char ascii_str[] = "tutorials point"; ... Read More

384 Views
In this tutorial, we will be discussing a program to convert a string into a square matrix grid of characters.For this we will be provided with a string of characters. Our task is to print that particular string in the format of a matrix grid having a certain number of rows and columns.Example Live Demo#include using namespace std; //converting the string in grid format void convert_grid(string str){ int l = str.length(); int k = 0, row, column; row = floor(sqrt(l)); column = ceil(sqrt(l)); if (row * column < l) row = column; ... Read More

715 Views
In this tutorial, we will be discussing a program to convert a sentence into its equivalent mobile numeric keypad sequence.For this we will be provided with a string of alphabetical characters. Our task is to print the numeric equivalent of the string i.e the numerical sequence of the keys to type that particular string.Example Live Demo#include using namespace std; //computing the numerical sequence string calc_sequence(string arr[], string input){ string output = ""; //length of input string int n = input.length(); for (int i=0; i

124 Views
In this tutorial, we will be discussing a program to convert a number of length N such that it contains any one digit at least ‘K’ times.For this we will be provided with a number of given length N. Our task is to convert the digits in the given number such that any one digit gets repeated at least ‘K’ times. Also, you have to calculate the cost of this operation which is the absolute difference between the two and finally print the minimum cost.Example Live Demo#include using namespace std; //calculating the minimum value and final number int get_final(int n, ... Read More

778 Views
In this tutorial, we will be discussing a program to convert a number m to n using minimum number of given operations.For this we will be provided with two integers m and n. Our task is to convert the integer m to n using the given operations least times.Allowed operations −Multiply the given number by 2Subtract one from the given numberExample Live Demo#include using namespace std; //finding minimum number of operations required int convert(int m, int n){ if (m == n) return 0; if (m > n) return m - n; //can't convert ... Read More

290 Views
In this tutorial, we will be discussing a program to convert a number into its negative base representation.For this we will be provided with a number and the corresponding negative base. Our task is to convert the given number into its negative base equivalent. We are allowing only values between -2 and -10 for negative base values.Example Live Demo#include using namespace std; //converting integer into string string convert_str(int n){ string str; stringstream ss; ss > str; return str; } //converting n to negative base string convert_nb(int n, int negBase){ //negative base equivalent for zero is ... Read More

226 Views
In this tutorial, we will be discussing a program to convert a normal binary search tree to balanced binary search tree.For this we will be provided with a skewed binary search tree either left or right. Our task is to convert it into a balanced binary search tree following a certain set of rules.Example Live Demo#include using namespace std; //node structure of tree struct Node{ int data; Node* left, *right; }; //traversing tree and storing node pointers //in vector nodes void store_nodes(Node* root, vector &nodes){ if (root==NULL) return; store_nodes(root->left, nodes); nodes.push_back(root); ... Read More

164 Views
In this tutorial, we will be discussing a program to convert a binary tree to a doubly linked list.For this we will be provided with a binary tree. Our task is to convert it into a doubly linked list such that the left and right pointers become the previous and next pointers. Also the sequential order of the doubly linked list must be equal to the inorder traversal of the binary tree.For this we are having a different approach. We will be traversing the binary tree in reverse inorder way. Along with we will be creating new nodes and moving ... Read More