All Easy Articles
For the below example tree, all root-to-leaf paths are: 10 –> 8 –> 3 10 –> 8 –> 5 10 –> 2 –> 2 Recommended… Read More
Using sizeof directly to find the size of arrays can result in an error in the code, as array parameters are treated as pointers. Consider… Read More
  Given an array arr[] of integers, find out the maximum difference between any two elements such that larger element appears after the smaller number. … Read More
Following questions have been asked in GATE CS 2005 exam.  1. Which one of the following is a key factor for preferring B-trees to binary… Read More
Given a binary tree and a number, return true if the tree has a root-to-leaf path such that adding up all the values along the… Read More
 In this post, we have seen in detail about the Inorder traversal and how it is implemented using recursion. Here in this post, we will… Read More
There is a list of items. Given a specific word, e.g., “sun”, print out all the items in list which contain all the characters of… Read More
Following questions have been asked in GATE CS 2005 exam. 1) A program P reads in 500 integers in the range [0..100] representing the scores… Read More
Original Linked List Result Linked List 1 Result Linked List 2 If there are odd number of nodes, then first list should contain one extra.… Read More
Given an integer n, find whether it is a power of 4 or not. Example :  Input : 16 Output : 16 is a power… Read More
Given a Doubly Linked List, the task is to reverse the given Doubly Linked List. Example: Input: Output: Recommended PracticeReverse a Doubly Linked ListTry It!… Read More
A height balanced binary tree is a binary tree in which the height of the left subtree and right subtree of any node does not… Read More
Following questions have been asked in GATE CS 2006 exam. 1. Consider the polynomial p(x) = a0 + a1x + a2x^2 +a3x^3, where ai !=… Read More
Consider the below program.  C void read(){   char str[20];   gets(str);   printf("%s", str);   return;} The code looks simple, it reads string from standard input and prints the entered string, but… Read More
The problem is opposite of this post. We are given a stack data structure with push and pop operations, the task is to implement a… Read More
C allows a void* pointer to be assigned to any pointer type without a cast, whereas in C++, it does not. We have to explicitly… Read More
Let us consider the below program.   C #include<stdio.h> void swap(char *str1, char *str2) { char *temp = str1; str1 = str2; str2 = temp;… Read More
Consider the below program.   C int main( ){  int arr[2] = {0,1};  printf("First Element = %d\n",arr[0]);  getchar();  return 0;} C++ // C++ Program to represent array in an… Read More
 In C, a string can be referred to either using a character pointer or as a character array.  Strings as character arrays   C char str[4]… Read More
Difficulty Level: Rookie Question 1 Predict the output of below program. int main() {   char arr[] = "geeksforgeeks";   printf("%d", sizeof(arr));   getchar();   return 0; } Output:… Read More