
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

271 Views
Suppose we have a pattern and a string called str, we have to check whether str follows the same pattern or not. Here pattern follow means a full match, such that there is a bijection between a letter in pattern and a non-empty substring in str.So, if the input is like pattern is "abaa", str is "orangegreenorangeorange", then the output will be trueTo solve this, we will follow these steps −Define a function solve(), this will take i, j, ptr, s, a map m, one set called used, if i >= size of s and j >= size of ptr, ... Read More

429 Views
Suppose we have a binary search tree and a target value; we have to find k values in that BST that are closest to the target. We have to keep in mind that the target value is a floating-point number. We can assume k is always valid, and k ≤ total nodes.So, if the input is liketarget = 3.714286, and k = 2, then the output will be [4, 3]To solve this, we will follow these steps −Define a function pushSmaller(), this will take node, stack st, and target, while node is not present, do −if val of node < ... Read More

560 Views
Suppose there is a new alien language and that uses the latin alphabet. However, the order among letters are not known. We have a list of non-empty words from the dictionary, these words are sorted lexicographically by the rules of this new language. we have to find the order of letters in this language.So, if the input is like ["wrt", "wrf", "er", "ett", "rftt" ], then the output will be "wertf"To solve this, we will follow these steps −Define one map called degreeDefine one map called graphn := size of wordsfor initialize i := 0, when i < size of ... Read More

438 Views
Suppose we have n houses in a row, now each house can be painted with one of the k colors. The painting cost of each house with a certain color is different. Now we have to keep in mind that we have to paint all the houses such that no two adjacent houses have the same color.The cost of painting each house with a certain color is represented by a matrix of order n x k. And we have to find the minimum cost to paint all houses.So, if the input is like153294then the output will be 5, as paint ... Read More

637 Views
Suppose we want to define a function to count the total strobogrammatic numbers that exist in the range of (low and high). As we know that a strobogrammatic number is a number that looks the same when rotated 180 degrees.So, if the input is like low = "50", high = "100", then the output will be 3 as there are three results, 69, 88, and 96.To solve this, we will follow these steps −Define a function findStrobogrammatic(), this will take n, Define an array retif n & 1 is non-zero, then −insert "0" at the end of retinsert "1" at ... Read More

2K+ Views
In this problem, we are given an array of string. Our task is to create a c program to sort an array of name or string. This program will sort all the names we have given in the input in ascending alphabetical order.Let’s take an example to understand the problem, InputnamesArray = ["Rishabh", "Jyoti", "Palak", "Akash"]Output["Akash", "jyoti", "palak", "Rishabh"]To solve this we will use the qsort() function of the standard template library as we know sorting of integer values the thing that changes here is we are considering string for comparison instead of integer values.So, the comparator that is used ... Read More

4K+ Views
In this problem, we are will create a C program to simulate non-deterministic Finite automata (NFA).NFA (Non-deterministic Finite automata) finite state machine that can move to any combination of states for an input symbol i.e. there is no exact state to which the machine will move.Formal definition of NDFA −NFA / NDFA (Non-deterministic Finite automata) can be represented by 5-tuple (Q, ∑, δ, q0, F) where −Q is a finite set of states.∑ is a finite set of symbols called the alphabets.δ is the transition function where d: Q × ∑ → 2Q (Here the power set of Q (2Q) ... Read More

429 Views
In this article, we are given a linked list. Our task is to create a C program to reverse each node value in singly linked list.We will take each node of the linked list and reverse the value.Linked list is a sequence of links that contains items that are linked to another link.Let’s take an example to understand the problem, Input34 12 89 56 72Output43 21 98 65 27To solve this problem, we will traverse the singly linked list and take each node. And then reverse the value of the current node.Program to reverse each node value in Singly Linked ... Read More

2K+ Views
In this problem, we are given an array of string. Our task is to create a c program to reverse array of strings.We will reverse the array elements i.e. last element to the first value and so on.Let’s take an example to understand the problem, Inputstrarr[] = {"learn", "programming", "at", "tutorialspoint"}Outputstrarr[] = {"tutorialspoint", "at", "programming", "learn"}To solve this problem, we will create an array of pointers and use two pointers from start and end. then move the pointers towards the opposite side, and keep on swapping the pointer values.C program to reverse array of strings.//c program to reverse array of ... Read More

6K+ Views
In this program, we have given three strings txt, oldword, newword. Our task is to create a C program to replace a word in a text by another given word.The program will search for all the occurrences of the oldword in the text and replace it with newword.Let’s take an example to understand the problem −Inputtext = “I am learning programming” oldword = “learning” newword = “practicing”Output“I am practicing programming”To solve this problem, we will first find the number of occurrence of the oldword in the string and then create a new string which will store the text with replaced ... Read More