Add office photos
Employer?
Claim Account for FREE

Infibeam

3.1
based on 37 Reviews
Filter interviews by

CODEC Networks Interview Questions and Answers

Updated 5 Feb 2024
Popular Designations

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

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

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

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
Discover CODEC Networks 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

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

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

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

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
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Software Engineer Interview Questions from Similar Companies

3.3
 • 79 Interview Questions
3.7
 • 16 Interview Questions
4.1
 • 16 Interview Questions
2.7
 • 12 Interview Questions
4.2
 • 11 Interview Questions
4.2
 • 10 Interview Questions
View all
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
70 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