Add office photos
Infibeam logo
Employer?
Claim Account for FREE

Infibeam

3.1
based on 37 Reviews
Filter interviews by
Software Engineer
Clear (1)

Infibeam Software Engineer Interview Questions and Answers

Updated 5 Feb 2024

Q1. Program to find the lowest common ancestor of two nodes in binary search tree as well as binary tree. I was also asked to give the brute force approach for the same

Ans.

Program to find lowest common ancestor of two nodes in binary search tree and binary tree with brute force approach.

  • For binary search tree, traverse from root to both nodes and store the path. Then compare paths to find LCA.

  • For binary tree, traverse from root to both nodes and store the path. Then compare paths to find LCA.

  • Brute force approach involves checking each node's descendants to see if they contain both nodes.

  • Time complexity for brute force approach is O(n^2) for wor...read more

Add your answer
right arrow

Q2. Given an unsorted array of numbers, find two numbers which add up to the given sum in O(n)

Ans.

Find two numbers in an unsorted array that add up to a given sum in O(n)

  • Use a hash table to store the difference between the sum and each element in the array

  • Iterate through the array and check if the current element is in the hash table

  • If it is, return the current element and the corresponding difference

  • If not, add the current element to the hash table

Add your answer
right arrow

Q3. Program to print the elements of a matrix in spiral order recursively

Ans.

Program to print matrix elements in spiral order recursively

  • Create a recursive function to print the elements in spiral order

  • Define the boundaries of the matrix and traverse the matrix in spiral order

  • Call the recursive function to print the elements in spiral order

  • Handle edge cases such as empty matrix or matrix with only one row/column

Add your answer
right arrow

Q4. Program to print all ancestors of a node in a binary tree

Ans.

Program to print all ancestors of a node in a binary tree

  • Create a recursive function to traverse the binary tree

  • Check if the current node is the target node

  • If yes, print all the nodes in the call stack

  • If not, recursively call the function for left and right subtrees

Add your answer
right arrow
Discover Infibeam interview dos and don'ts from real experiences

Q5. Program to implement Dijkstra’s algorithm

Ans.

Dijkstra's algorithm finds shortest path between nodes in a graph

  • Create a graph with nodes and edges

  • Initialize distances from source node to all other nodes as infinity

  • Set distance from source node to itself as 0

  • Create a set of unvisited nodes

  • While unvisited set is not empty, select node with minimum distance

  • For each neighbor of selected node, calculate distance from source node

  • If calculated distance is less than current distance, update distance

  • Mark selected node as visited

  • R...read more

Add your answer
right arrow

Q6. Program to implement Floyd­Warshall’s agorithm

Ans.

Floyd-Warshall's algorithm is used to find the shortest path between all pairs of vertices in a weighted graph.

  • Create a 2D array to store the distances between all pairs of vertices.

  • Initialize the array with the weights of the edges in the graph.

  • Use nested loops to iterate over all pairs of vertices and update the distances if a shorter path is found through a third vertex.

  • The final array will contain the shortest distances between all pairs of vertices.

Add your answer
right arrow

Q7. Program to swap two pointers

Ans.

A program to swap two pointers.

  • Declare two pointers of the same data type

  • Assign the first pointer to a temporary variable

  • Assign the second pointer to the first pointer

  • Assign the temporary variable to the second pointer

Add your answer
right arrow

Q8. Explain indexing in DBMS

Ans.

Indexing is a technique used in DBMS to improve the performance of queries.

  • Indexing creates a separate data structure that allows faster retrieval of data.

  • It works by creating a pointer to the location of data in the table.

  • Indexes can be created on one or more columns of a table.

  • Types of indexing include B-tree, hash, and bitmap indexing.

  • Indexes can also be clustered or non-clustered.

  • Clustered indexes determine the physical order of data in a table.

  • Non-clustered indexes creat...read more

Add your answer
right arrow

Q9. Explain B and B+ trees

Ans.

B and B+ trees are data structures used for efficient searching and sorting of large datasets.

  • B trees are balanced trees used for disk-based storage systems.

  • B+ trees are similar to B trees but have all data stored in the leaf nodes for faster searching.

  • B trees have a variable number of keys per node, while B+ trees have a fixed number.

  • B trees have a higher fanout than B+ trees, making them more efficient for smaller datasets.

  • B+ trees are commonly used in databases and file sy...read more

Add your answer
right arrow
Contribute & help others!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
interview tips and stories logo
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Software Engineer Interview Questions from Similar Companies

Wipro Logo
3.7
 • 124 Interview Questions
Mphasis Logo
3.4
 • 25 Interview Questions
Xoriant Logo
4.1
 • 15 Interview Questions
Yodlee Logo
3.8
 • 13 Interview Questions
View all
Recently Viewed
INTERVIEWS
Wonder Cement
No Interviews
INTERVIEWS
Wonder Cement
No Interviews
JOBS
Kohler
No Jobs
INTERVIEWS
Wonder Cement
No Interviews
JOBS
GHCL Limited
No Jobs
INTERVIEWS
Infibeam
No Interviews
LIST OF COMPANIES
GHCL Limited
Overview
JOBS
Cortex Consulting
No Jobs
INTERVIEWS
HomeShop18
No Interviews
JOBS
Ladderup Wealth Management
No Jobs
Share an Interview
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
75 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter