Data Structure interview questions – page 22
893 questions. Tap “Show answer” to check yourself.
-
Write a function for N-ary tree traversal - min time constraint
-
Write a function that returns true if two given strings are anagram of each other and false otherwise. What is the time complexity of ur solution? How would you improve it?
-
You are given a system of passing binary trees among 2 ppl
-
Tree traversals .. non recursive and recursive ...
-
Level Order Traversal of a Binary Search Tree ( Using Queue )
-
Write code to Insert a node into a sorted circular singly linked list such that the list remains sorted.
-
Given a complete binary tree in which each and every node has a next pointer which is pointing to NULL . Write a function to make the next pointer of each and every node point to next node on the same level
-
A complete ternary tree is a tree in which each and every node has either 0 or 3 children. Given preorder of a complete ternary tree, construct the tree . Preorder will be a string containing characterd i and l where i represents an internal node ...
-
How would you allocate memory for a 2d array, using malloc only once... after the allocation the elements of the array shud be accessible by normal notation a[i][j] i.e. its not desired to access the elements in the form *(a+i*rows+col)
-
Given a tree, find a faulty link and remove it.
-
Suggest a compact data structure representation of a graph
-
Remove the nth element from the end from a singly linked list.
- Advertisement
-
Provided a string S of words and no of character per line m ,with m being greater than the longest phrase in S,print S in a set of lines so that every single line includes no far more than m characters and no phrase split between two lines.
-
Data structure TO use to design a phonebook. What is time complexity for retrieving, adding etc
-
Convert a doubly linked list to a binary search tree in place.
-
Find out all the valid words of a given string....something like an anagram. Valid word in the sense an english word in the dictionary..... the function prototype is..... int anagram(char *string)...this should return the count of the ...
-
Given a BST and two integers X and Y such that X < Y. Cut down the BST so that the BST contains numbers only between X and Y.
-
Find all the patterns which are present in the character array given. A pattern is a sub-array containing 2 or more chars and is having a frequency of more than one.
-
Integer has been represented in linked list. Eg. 7541 has been represented as 7->5->4->1 with 4 nodes each having a digit. Given 2 such linked lists, you need to compute the sum of them
-
A Binary Tree is represented in an int array such that if P is parent and c is its children..a[c]=p a) Construct a Binary Tree if Such An Array is given b) uve given an index of node representing root of sub tree.. If we ignore t...
-
Given a string, find out the MINIMUM number of palindromes needed to construct the string. Note that maximum number is length of the string iteself as every string with one character is a palindrome
-
You are given 3 integer arrays A, B and C of length n1, n2 and n3 respectively. All arrays are sorted. We define triplet of these 3 arrays as (x,y,z) where x is any integer from A, y from B and z from C. We define distance of triplet as maximum di...
-
Find out if 2 given binary trees are identical (data is same in both trees)
-
Given a sentence ex:"I love Microsoft" reverse the string as "Microsoft love I".
- Advertisement
-
Compare linked list and arrays
-
Given a binary tree with no size limitation, write a program to find the sum of each vertical level and store the result in an appropriate data structure (Note: You cannot use an array as the tree can be of any size).
-
Design a soln, expalin the DataStructure used and write efficiency class for finding out the top 100 frequently used words in the editor. The words are updated in the DS used for every added or deleted words and the functions below are called for ...
-
There are two nodes given in a tree(not binary tree). Find whether one node is parent/grandparent of other. Order should be O(1).
-
Write code to return the kth largest element in a tree. function prototype is int fucnkth(node *root, int k)
-
Discuss algo of insertion of an element in AVL tree, discuss complexity and code it.