GeeksforGeeks

A computer science portal for geeks

Given a Singly Linked List which has data members sorted in ascending order. Construct a Balanced Binary Search Tree which has same data members as the given Linked List.

Read More »

Given an array of integers which is initially increasing and then decreasing, find the maximum value in the array.

Read More »

Write a function to connect all the adjacent nodes at the same level in a binary tree. Structure of the given Binary Tree node is like following.

Read More »

Write a function to connect all the adjacent nodes at the same level in a binary tree. Structure of the given Binary Tree node is like following.

Read More »

Given two integers k and n, write a function that prints all the sequences of length k composed of numbers 1,2..n. You need to print these sequences in sorted order.

Read More »

Why performance analysis? There are many important things that should be taken care of, like user friendliness, modularity, security, maintainability, etc. Why to worry about performance?

Read More »

Scope of an identifier is the part of the program where the identifier may directly be accessible. In C, all identifiers are lexically (or statically) scoped. C scope rules can be covered under following two categories.

Read More »

Consider the following C programs.

Read More »

Predict the output of following C++ program.

Read More »

Question: How to deallocate dynamically allocate memory without using “free()” function.

Read More »

Predict the output of following C program.

Read More »

Given an array A[0 ... n-1] containing n positive integers, a subarray A[i ... j] is bitonic if there is a k with i < = k = A[j].

Read More »

Predict the output of following C++ program.

Read More »

A function is called pure function if it always returns the same result for same argument values and it has no side effects like modifying an argument (or global variable) or outputting something.

Read More »

Predict the output of following C programs: Difficulty Level: Rookie

Read More »

Ever wondered how can you design a class in C++ which can’t be inherited. Java and C# programming languages have this feature built-in. You can use final keyword in java, sealed in C# to make a class non-extendable.

Read More »

Given a string, find the length of the longest substring without repeating characters. For example,

Read More »

Given an array of n distinct integers sorted in ascending order, write a function that returns a Fixed Point in the array, if there is any Fixed Point present in array, else returns -1.

Read More »

In the previous post on trie we have described how to insert and search a node in trie. Here is an algorithm how to delete a node from trie.

Read More »

The volatile keyword is intended to prevent the compiler from applying any optimizations on objects that can change in ways that cannot be determined by the compiler.

Read More »

Given a Singly Linked List, write a function to delete a given node. Your function must follow following constraints:

Read More »

Consider simple representation (without any dummy node) of Linked List. Functions that operate on such Linked lists can be divided in two categories:

Read More »

Consider the following Java program:

Read More »

Like C++, Java also supports copy constructor. But, unlike C++, Java doesn’t create a default copy constructor if you don’t write your own.

Read More »

Question 1 Predict the output of the following program. What does the following fun() do in general?

Read More »