Rovi
SJ Jaiswal and Associates Interview Questions and Answers
Q1. Given a big string and words from dictionary as query, find number of times each word occur in big string in efficient way
The task is to count the occurrences of words from a dictionary in a big string efficiently.
Create a hash map to store the count of each word from the dictionary.
Split the big string into words and iterate through each word.
Check if the word exists in the dictionary and update its count in the hash map.
Return the hash map with word counts.
Q2. Given a directed dependency graph find sequence to install packages if each node has a structure of package name and dependency list
Given a directed dependency graph, find sequence to install packages if each node has a structure of package name and dependency list.
Use topological sorting algorithm to find the installation sequence
Start with nodes that have no dependencies and gradually remove dependencies as packages are installed
If there is a cycle in the graph, it is not possible to find a valid installation sequence
Q3. Find peak in increasing and decreasing sequence
Find peak in increasing and decreasing sequence
Use binary search to find the peak element
Compare the middle element with its neighbors to determine if it's a peak
If the middle element is smaller than its left neighbor, search in the left half of the array
If the middle element is smaller than its right neighbor, search in the right half of the array
Q4. Concatenation of two strings in c
Concatenation of two strings in C
Use the strcat() function to concatenate two strings in C
Make sure the destination string has enough space to hold the concatenated result
The destination string should be null-terminated before concatenation
Q5. Inorder traversal of a binary tree
Inorder traversal is a depth-first traversal algorithm that visits the left subtree, then the root, and finally the right subtree.
Start at the root node
Traverse the left subtree recursively
Visit the root node
Traverse the right subtree recursively
Q6. Is BST or not?
BST stands for Binary Search Tree.
BST is a type of binary tree where each node has at most two children.
In a BST, the left child of a node is always smaller than the node, and the right child is always greater.
BSTs are commonly used for efficient searching, insertion, and deletion operations.
Example: [5, 3, 7, 2, 4, 6, 8] is a BST.
Q7. Construct BST using preorder traversal
Construct a Binary Search Tree (BST) using preorder traversal.
Preorder traversal visits the root node first, then the left subtree, and finally the right subtree.
To construct a BST from preorder traversal, we can use a recursive approach.
The first element in the preorder traversal is the root of the BST.
All elements smaller than the root will be in the left subtree, and all elements greater than the root will be in the right subtree.
Recursively apply the above steps to constr...read more
More about working at Rovi
Top Associate Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month