# Tag Archives: SAP Labs

Like Merge Sort, QuickSort is a Divide and Conquer algorithm. It picks an element as a pivot and partitions the given array around the picked… Read More
Hi, A brief documentation of my SAP Labs, India interview is as follows: Interview Round 1: Q1. What is I of ACID properties? Q2. What… Read More
Given an array of random numbers, Push all the zero’s of a given array to the end of the array. For example, if the given… Read More
The cost of a stock on each day is given in an array. Find the maximum profit that you can make by buying and selling… Read More
What is Heap Sort Heap sort is a comparison-based sorting technique based on Binary Heap data structure. It is similar to the selection sort where… Read More
Given an array arr[] where each element represents the max number of steps that can be made forward from that index. The task is to… Read More
Given that integers are read from a data stream. Find the median of elements read so for in an efficient way. For simplicity assume, there… Read More
Given a boolean matrix mat[M][N] of size M X N, modify it such that if a matrix cell mat[i][j] is 1 (or true) then make… Read More
Given two binary trees, check if the first tree is a subtree of the second one. A subtree of a tree T is a tree… Read More
Given an array and an integer K, find the maximum for each and every contiguous subarray of size K. Examples :  Input: arr[] = {1,… Read More
Given an n x n matrix and an integer x, find the position of x in the matrix if it is present. Otherwise, print “Element… Read More
Given an array A[] consisting of only 0s, 1s, and 2s. The task is to write a function that sorts the given array. The functions… Read More
Given a linked list, write a function to reverse every k nodes (where k is an input to the function).  Example:  Input: 1->2->3->4->5->6->7->8->NULL, K =… Read More
Given a string, the task is to reverse the order of the words in the given string.  Examples: Input: s = “geeks quiz practice code” Output:… 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