
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 1339 Articles for C

12K+ Views
Backtracking is a technique to solve dynamic programming problems. It works by going step by step and rejects those paths that do not lead to a solution and trackback (moves back ) to the previous position.In the subset sum problem, we have to find the subset of a set is such a way that the element of this subset-sum up to a given number K. All the elements of the set are positive and unique (no duplicate elements are present).For this, we will create subsets and check if their sum is equal to the given number k. Let's see a ... Read More

838 Views
Matrix MultiplicationNow procedure of Matrix Multiplication is discussed. The Matrix Multiplication can only be performed, if it satisfies certain condition. Suppose two matrices are P and Q, and their dimensions are P (a x b) and Q (z x y) the resultant matrix can be found if and only if b = x. Then the order of the resultant matrix R will be (m x q).AlgorithmmatrixMultiply(P, Q): Assume dimension of P is (a x b), dimension of Q is (z x y) Begin if b is not same as z, then exit otherwise define R matrix as (a ... Read More

14K+ Views
A sorting algorithm is an algorithm that puts components of a listing in a certain order. The most-used orders are numerical order and lexicographic order.The Radix sort is a non-comparative sorting algorithm. The Radix sort algorithm is the most preferred algorithm for the unsorted list.It sorts the elements by initially grouping the individual digits of the same place value. The idea of Radix Sort is to do digit by digit sort starting from least significant digit(LSD) to the most significant digit(MSD), according to their increasing/decreasing order. Radix sort is a small method that is used several times when alphabetizing an ... Read More

3K+ Views
Pattern matching in C − We have to find if a string is present in another string, as an example, the string "algorithm” is present within the string "naive algorithm". If it is found, then its location (i.e. position it is present at) is displayed. We tend to create a function that receives 2character arrays and returns the position if matching happens otherwise returns -1.Input: txt = "HERE IS A NICE CAP" pattern = "NICE" Output: Pattern found at index 10 Input: txt = "XYZXACAADXYZXYZX" pattern = "XYZX" Output: Pattern found at index 0 Pattern found at index ... Read More

8K+ Views
Pattern matching in C− We have to find if a string is present in another string, as an example, the string "algorithm” is present within the string "naive algorithm". If it is found, then its location (i.e. position it is present at) is displayed. We tend to create a function that receives 2 character arrays and returns the position if matching happens otherwise returns -1.Input: txt = "HERE IS A NICE CAP" pattern = "NICE" Output: Pattern found at index 10 Input: txt = "XYZXACAADXYZXYZX" pattern = "XYZX" Output: Pattern found at index 0 Pattern found at ... Read More

642 Views
We are given, an array of non-negative integers denoting the maximum number of steps that can be made forward from that element. The pointer is initially positioned at the first index [0 index] of the array. Your goal is to reach the last index of the array in the minimum number of steps. If it is not possible to reach the end of the array then print the maximum integer.naive approach is to begin from initial{the primary} component and recursively call for all the components accessible from the first element. The minimum range of jumps to reach the end from ... Read More

886 Views
Here, we will solve the minimum cost path problem in C. The implication is done on a 2D-matrix where each cell has a cost to travel. We have to find a path from the left top corner to the bottom right corner with minimum travel cost. You can only traverse down and right lower cells from a given cell.To solve this particular problem dynamic programming is much better to approach than recursion.Given cost matrix cost[ ][ ] and a position (m, n), we have to write a function that returns cost of minimum path to reach (m, n) from (0, ... Read More

550 Views
The problem states that what will be the working or the output if the scanf is followed by fgets()/gets()/scanf().fgets()/gets() followed by scanf()Example Live Demo#include int main() { int x; char str[100]; scanf("%d", &x); fgets(str, 100, stdin); printf("x = %d, str = %s", x, str); return 0; }OutputInput: 30 String Output: x = 30, str =Explanationfgets() and gets() are used to take string input from the user at the run time. I above code when we run enter the integer value then it won’t take the string value because when we gave newline after the integer ... Read More

7K+ Views
Process synchronization is the technique to overcome the problem of concurrent access to shared data which can result in data inconsistency. A cooperating process is the one which can affect or be affected by other process which will lead to inconsistency in processes data therefore Process synchronization is required for consistency of data.The Critical-Section ProblemEvery process has a reserved segment of code which is known as Critical Section. In this section, process can change common variables, update tables, write files, etc. The key point to note about critical section is that when one process is executing in its critical section, ... Read More

643 Views
Given the task is to print the written C program itself.We have to write a C program which will print itself. So, we can use file system in C to print the contents of the file of which we are writing the code, like we are writing the code in “code 1.c” file, so we open the file in the read mode and read all the contents of the file and print the results on the output screen.But, before opening a file in read mode, we must know the name of the file we are writing code in. So, we ... Read More