## C Program for Merge Sort for Linked Lists

Merge sort is often preferred for sorting a linked list. The slow random-access performance of a linked list makes some other algorithms (such as quicksort)… Read More »

## Merge Sort for Linked Lists

Merge sort is often preferred for sorting a linked list. The slow random-access performance of a linked list makes some other algorithms (such as quicksort)… Read More »

Two Linked Lists are identical when they have same data and arrangement of data is also same. For example Linked lists a (1->2->3) and b(1->2->3)… Read More »

## Data type of character constants in C and C++

In C, data type of character constants is int, but in C++, data type of same is char. If we save below program as test.c… Read More »

## Write one line functions for strcat() and strcmp()

Recursion can be used to do both tasks in one line. Below are one line implementations for stracat() and strcmp(). filter_none edit close play_arrow link… Read More »

## A nested loop puzzle

Which of the following two code segments is faster? Assume that compiler makes no optimizations. filter_none edit close play_arrow link brightness_4 code /* FIRST */… Read More »

## Merge two sorted linked lists

Write a SortedMerge() function that takes two lists, each of which is sorted in increasing order, and merges the two together into one list which… Read More »

## Total number of possible Binary Search Trees and Binary Trees with n keys

Total number of possible Binary Search Trees with n different keys (countBST(n)) = Catalan number Cn = (2n)! / ((n + 1)! * n!) For… Read More »

## G-Fact 8

To uniquely construct a Binary Tree, Inorder together with either Postorder or Preorder must be given (See this for details). However, either Postorder or Preorder… Read More »

## Output of C Programs | Set 14

Predict the output of below C programs. Question 1 filter_none edit close play_arrow link brightness_4 code #include<stdio.h> int main() {    int a;    char *x;    x… Read More »

## Alternating split of a given Singly Linked List | Set 1

Write a function AlternatingSplit() that takes one list and divides up its nodes to make two smaller lists ‘a’ and ‘b’. The sublists should be… Read More »

## Delete alternate nodes of a Linked List

Given a Singly Linked List, starting from the second node delete all alternate nodes of it. For example, if the given linked list is 1->2->3->4->5… Read More »

## Practice Questions for Recursion | Set 2

Explain the functionality of following functions. Question 1 filter_none edit close play_arrow link brightness_4 code /* Assume that n is greater than or equal to… Read More »

## A Product Array Puzzle

Given an array arr[] of n integers, construct a Product Array prod[] (of same size) such that prod[i] is equal to the product of all… Read More »

## How are variables scoped in C – Static or Dynamic?

In C, variables are always statically (or lexically) scoped i.e., binding of a variable can be determined by program text and is independent of the… Read More »