All Basic Articles
Question: Is there any example for which the following two loops will not work the same way?   C /*Program 1 --> For loop*/ for… Read More
Given a linked list, print reverse of it using a recursive function. For example, if the given linked list is 1->2->3->4, then output should be… Read More
Write a program to print all the LEADERS in the array. An element is a leader if it is greater than all the elements to… Read More
Following questions have asked in GATE CS exam.  1. Suppose you are given an array s[1…n] and a procedure reverse (s,i,j) which reverses the order… Read More
Write a function rotate(arr[], d, n) that rotates arr[] of size n by d elements. Example: Input: arr[] = [1, 2, 3, 4, 5, 6,… Read More
Write a Java Program for a given array of integers arr[] of size N and an integer, the task is to rotate the array elements to the left by d positions. Examples:   Input: arr[]… Read More
A node is a leaf node if both left and right child nodes of it are NULL. Here is an algorithm to get the leaf node… Read More
Array reverse or reverse a array means changing the position of each number of the given array to its opposite position from end, i.e. if… Read More
Following questions have been asked in GATE CS exam. 1. Consider the following C program segment: char p[20]; char *s = "string"; int length =… Read More
Following questions have been asked in GATE CS exam  1. Let LASTPOST, LASTIN and LASTPRE denote the last vertex visited in a postorder, inorder and… Read More
Following questions have been asked in GATE CS exam. 1. Consider the following three C functions : [PI] int * g (void)  {    int x… Read More
  Given a sorted linked list and a value to insert, write a function to insert the value in a sorted way.Initial Linked List  Linked… Read More
Difficulty Level: RookieQuestion: Write a program to print N equal parts of a given string.  Solution: 1) Get the size of the string using string function strlen()… Read More
Given two numbers A and B. Write a program to count the number of bits needed to be flipped to convert A to B.  Examples: … Read More
Write a function to find the node with minimum value in a Binary Search Tree. Example:  Input:   first example BST Output: 8 Input:   second example… Read More
Write an efficient program to count number of 1s in binary representation of an integer. Examples : Input : n = 6 Output : 2… Read More
Write an efficient program to count number of 1s in binary representation of an integer. Examples : Input : n = 6 Output : 2… Read More
The Function prototype is necessary to serve the following purposes: Function prototype tells the return type of the data that the function will return. Function… Read More
Given a pointer to the head node of a linked list, the task is to reverse the linked list. We need to reverse the list… Read More
It depends on what traversals are given. If one of the traversal methods is Inorder then the tree can be constructed, otherwise not.    … Read More