Data Structure interview questions – page 14
893 questions. Tap “Show answer” to check yourself.
-
Your are given a doubly linked list such that one link points to the immediate next node and other link points to some arbitrary nodes in the doubly linked list. Write a function to duplicate such doubly linked lists.
-
Connect the leafs in a binary tree and return a reference to the first of the linked leafs. This would allow clients of this API to subsequently traverse the leafs. The API has a fLR flag indicating if the leafs should be connected from left-right...
-
Implement the function : node * add(node *l1, node *l2). The lists L1 and L2 are linked lists where each node of the linked list contains a single hexadecimal digit, represented as a char. The whole list thus represents a hexadecimal number. We ha...
-
Given a string consisting of a, b and c's, we can perform the following operation: Take any two adjacent distinct characters and replace it with the third character. For example, if 'a' and 'c' are adjacent, they can replaced with 'b'.
-
Write working code to find the inorder successor of a given node in a bst
-
Remove duplicates from and unsorted list, optimize it.
-
Find the number of strings of length n having u distinct uppercase letters , l distinct lowercase letters and d distinct digits.
-
Function to check if a binary tree is a BST or not
-
Deletion Of Duplicates in a BST [Adobe] Given a Binary Search Tree with many duplicates. Assume that while building the BST , the equal values are inserted in the left sub-tree. You just have the root pointer of the tree. Give an algor...
-
Find the nearest sibling of a given node in a tree. Nodes on same level are siblings of each other.
-
Write a C function that takes two strings as parameter and removes the common characters from the first string.
-
Given a Special BT in which Each Non Leaf Node Except Root Has at-least two children .Given Pre-order and Post-order of Tree Your Task is to design the tree From the Given Information..
- Advertisement
-
Write C code to find maximum and second maximum in an array
-
Let S={i*i:1<=i<=100}be a array of integers. A subarray T of S is called a intersting subarray if |T|=30(i.e.cardinality of T is 30)and there exist no other distinct subarray of S of cardinality 30 whose sum equal to sum(T).Write a pro...
-
Give a good data structure for having n queues ( n not fixed) in a finite memory segment. You can have some data-structure separate for each queue. Try to use at least 90% of the memory space
-
How to convert a given max heap to min heap?
-
In a linked-list the nodes are 1 2 3 4 5 67 8 9 we have to rearrange linked-list so that it contain nodes are 3 2 1 6 5 4 9 8 7
-
You are given a doubly link list and out of some nodes of this doubly linked list, some other doubly link list emerge and from some of these emerging doubly linked list, more doubly link list emerge. You have to write a quick algo that merges all ...
-
Find vertical sum of given binary tree.
-
Numbers are randomly generated and passed to a method. Write a program to find and maintain the median value as new values are generated.
-
Given an array with list of numbers. For each element in the array, find out it's next subsequent smaller element in the array , and replace the element with it's next subsequent smaller value in the new array. Ex : input - [4, 7, 9, 8, 6, 5...
-
Pointer 'F' to head of singly Linked List is given. How to reverse first two nodes of LL?
-
Given: 2 Unsorted single linked list Todo: Fastest and optimized way to merge and make a single sorted list with these 2 unsorted single linked list.
-
You are given a node of a tree. The node is defined as below:
- Advertisement
-
Under what circumstances can one delete an element from a singly linked list in constant time?
-
WAP to generate All Possible Palindrome of String e.g for sting abccba all possible is
-
Given a Binary Tree, find the max size sub-tree which is a Binary Search Tree. Optimize for space & Time
-
Find common parent of two leaf nodes in a tree (The tree is not a BST and can have duplicates)
-
One of the nodes has two parents in a given binary tree. Find out the node having two parents?
-
How to merge two Binary Search Trees?