Data Structure interview questions – page 12
893 questions. Tap “Show answer” to check yourself.
-
Write code to add 2 hexadecimal nos, whose digits are represented as nodes of Linked List, one digit per node... and one linked list per hexadecimal number. eg. Head->2->A->9->NULL for 2A9 Like this u take 2 hexadecimal nos...
-
Find out first non-repeating character in a s tring
-
Given three arrays A[], B[] and C[], write a function that returns 1 if there exist a triplet (x, y, z) whose sum is 0, i.e., x + y +z =0. Where x belongs to A, y to B[] and z to C[].
-
Give a string with spaces how will u compact it. Give various possible inputs for this. Optimise ur code .
-
Convert bst into dll without using recursion . then convert Binary tree into dll without using recursion
-
Given an array having 16000 unique integers, each lying within the range 1<20000, how do u sort it. U can load only 1000 numbers at a time in memory.
-
You have given a binary search tree. Using this tree make a sorted doubly linked list using the elements of binary tree. ( this should be done in place. That means once you are done with procedure your tree should destroy and it should be converte...
-
Given a inorder traversal eg 1 2 3 4 5 6 7 8 9 , Check which of the following preorder traversal will it return . a. 1 6 3 2 7 8 4 9 b. 6 7 3 8 1 9 2 7 c, 2 4 6 8 1 3 5 7 d. 1 3 5 7 2 4 6 8
-
Given an array of dimension n with very first l positions crammed with characters and a string s ,replace all the instances of % with this string s,offered that the lengh of the array is enough to deal with these substitutions.
-
What data structure would you use to pass 1MB of data to OS from network layer for packet delivering?
-
Given a linked list,find whether a loop exists in it or not,if yes then return a pointer to the start node of the loop?
-
Program to tokenize a given string
- Advertisement
-
Given a string, print each character and its number of occurence in sequence. use BST and no recursion, no extra memory is allowed.
-
Given an array of Integers, if u are on ith element u can make max arr jumps. If i am at an element with value zero, i cannot move forward. find the least selection to reach end of the array. ex: 1 3 5 8 9 2 6 7 6 8 9 starting with arr...
-
Offered a binary tree verify whether it is a binary search tree or not?
-
You are given an array of size N; filled with numbers from 1 to N (in random order). One no. is missing and one no. is repeated twice. Find missing no. and repeated no. in time complexity O(n) and space complexity O(1).
-
Given two n-ary trees T1 and T2. Write a program to check if T1 has T2 in it.
-
Given a list of words ...you have infinite pre-processing time.Now you are given a word...output all the words from the dictionary that are anagram of this word as efficiently as possible.
-
Given a binary tree, convert it to doubly linked list. if you are going for a company interview, then read the solution before interview.
-
Given a list of numbers and a number x, find two numbers in the list such that product of those 2 numbers is equal to x.
-
Given stwo strings, find the characters which are in first string and not in the second one and vice-versa
-
Array of integers like 10 12 16 17 24 27 8 6 5 4 2. From 10 to 27 it is in increasing order and then decreasing order starts. So he asked me to find the position from where decreasing starts. it should be done in O(logn).
-
Given a Binary Search Tree and two values, print all the nodes having values between the two given values (include the two given values).
-
Having an int array, size of array is infinite (no way to find out), how do you do a binary search?
- Advertisement
-
Given two arrays of numbers, find if each of the two arrays have the same set of integers? Suggest an algo which can run faster than NlogN?
-
Design a data structure that can do all four operationm in O(1) e.g. constant time
-
You are given a binary tree with follwing node structure; struct node{ int data; node *rchild; node *lchild; node *right; }; write a procedure such that each node points to its immediate right ...
-
How to delete the duplicates in a Binary Tree?
-
Given a sorted array, find the element whose value is equal to the index, i.e., arr[x] = x. solve it in O(Logn) time.
-
Given a sorting order string, sort the input string based on the given sorting order string. Ex sorting order string -> dfbcae Input string -> abcdeeabc output -> dbbccaaee