Fellowship
Fellowship Interview Questions and Answers
Popular Companies
Q1. find middle element of LinkedList
To find the middle element of a LinkedList, use two pointers - one moving at double the speed of the other.
Initialize two pointers, slow and fast, at the head of the LinkedList.
Move the slow pointer by one step and the fast pointer by two steps until the fast pointer reaches the end of the LinkedList.
The element pointed to by the slow pointer at this point will be the middle element.
Q2. Implementation of stack and queue
Stack and queue can be implemented using arrays or linked lists. Stack follows LIFO while queue follows FIFO.
Stack can be implemented using arrays with push and pop operations.
Queue can be implemented using arrays with enqueue and dequeue operations.
Both stack and queue can also be implemented using linked lists for dynamic size.
Example: Implementing a stack using an array in C++
Example: Implementing a queue using a linked list in Java
Q3. Implementation of BST
BST (Binary Search Tree) is a data structure where each node has at most two children, with left child being less than parent and right child being greater.
BST is used for efficient searching, insertion, and deletion of elements.
In-order traversal of BST gives elements in sorted order.
Example: Inserting elements 5, 3, 8, 1, 4 into a BST would result in a tree with root 5, left child 3, right child 8, and left child of 3 having children 1 and 4.
Q4. Q2. Write insertion sort algo.
Insertion sort is a simple sorting algorithm that builds the final sorted array one item at a time.
Start with the second element and compare it with the first element, swap if necessary
Move to the third element and compare it with the first and second elements, swap if necessary
Continue this process until the entire array is sorted
Time complexity is O(n^2)
Q5. recursion on array
Recursively iterate through an array of strings
Use a base case to stop the recursion
Pass a smaller portion of the array in each recursive call
Concatenate or manipulate the strings as needed
Fellowship Jobs
Interview experiences of popular companies
Calculate your in-hand salary
Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary
Reviews
Interviews
Salaries
Users/Month