Given an expression string exp, write a program to examine whether the pairs and the orders of “{“, “}”, “(“, “)”, “[“, “]” are correct in exp....
Write an efficient program to find the sum of contiguous subarray within a one-dimensional array of numbers that has the largest sum....
Given an array A[] consisting 0s, 1s and 2s. The task is to write a function that sorts the given array. The functions should put all 0s first, then all 1s and all 2s in last.Examples:...
Given an array, print the Next Greater Element (NGE) for every element. The Next greater Element for an element x is the first greater element on the right side of x in the array. Elements for which no greater element exist, consider the next greater element as -1....
Given a singly linked list of characters, write a function that returns true if the given list is a palindrome, else false....
An element in a sorted array can be found in O(log n) time via binary search. But suppose we rotate an ascending order sorted array at some pivot unknown to you beforehand. So for instance, 1 2 3 4 5 might become 3 4 5 1 2. Devise a way to find an element in the rotated array in O(log n) time....
Given a linked list, write a function to reverse every k nodes (where k is an input to the function)....
Given a linked list where every node represents a linked list and contains two pointers of its type:...
Given an array A[] consisting 0s, 1s and 2s. The task is to write a function that sorts the given array. The functions should put all 0s first, then all 1s and all 2s in last.Examples:...
Given two numbers represented by two lists, write a function that returns the sum list. The sum list is a list representation of the addition of two input numbers....
Given two numbers represented by two linked lists, write a function that returns the sum list. The sum list is linked list representation of the addition of two input numbers. It is not allowed to modify the lists. Also, not allowed to use explicit extra space (Hint: Use Recursion)....
Given a linked list, write a function to reverse every k nodes (where k is an input to the function). Examples:...