- Write a function that will transform Prefix to Infix Conversion?
- If linked list having a loop is given. Count the number of nodes in the linked list //Sorts a given list by selection sort //Input: An array A[0..n-1] of orderable elements //Output: List A[0..n-1]
- Write a program to Reverse a stack using queue?
- Write a program to Reverse a queue using stack
- What will be the complexity of the above solution?
- In given pile of patient files of High, mid and low priority. Sort these files such that higher priority comes first, then mid and last low priority.Types Of SortInternal Sorting: All the elements
- In the above Search List program return, the count of how many instances of same value are found else if value not found then return 0.For example, if the value passed is “4”. The elements in the
- Find the middle element in a singly linked list. Tell the complexity of your solution.First solution: Find the length of linked list. Then find the middle element and return it.Second solution: Use
- Converting Decimal Numbers to Binary Numbers using stack data structure.store reminders into the stack and then print the stack.
- Given two values X and Y. You need to convert X to Y by performing various steps. In a step, we can either multiply 2 to the value or subtract 1 from it. You need to display the number of steps and
- Construct a tree given its in-order and pre-order traversal strings.ino-rder: 1 2 3 4 5 6 7 8 9 10 pre-order: 6 4 2 1 3 5 8 7 9 10
- Construct a tree given its in-order and post-order traversal strings.in-order: 1 2 3 4 5 6 7 8 9 10 post-order: 1 3 2 5 4 7 10 9 8 6
- Write a delete node function in Binary tree.
- Check whether a given Binary Tree is a Perfect binary tree or not. The perfect binary tree- is a type of full binary trees in which each non-leaf node has exactly two child nodes.
- The worst-case runtime Complexity of insertion into a BST with n nodes is O(n2)O(n * log n)O(n)O(logn)
- The worst-case runtime Complexity of a search of a value in a BST with n nodes is:O(n2)O(n * log n)O(n)O(logn)
- Which of the following traversals always gives the sorted sequence of the elements in a BST?Preorder Ignored Postorder Undefined
- Try to optimize the above solution to give a DFS traversal without using recursion use some stack or queue.
- This is an open exercise for the readers. Every algorithm that is solved using recursion (system stack) can also be solved using user defined or library defined stack. So try to figure out what all
- In a binary tree, print the nodes in zigzag order. In the first level, nodes are printed in the left to right order. In the second level, nodes are printed in right to left and in the third level
- Find the Ceil value of key, which is inside a BST.
- What is Time Complexity of the below pseudo code: Function DFS (head): curr = head count = 0; while (curr != None && curr.visited == False): count++; if (curr.1Child != None && curr.lChild.visited ==
- What is the worst-case runtime Complexity of finding the smallest item in a min-heap?
- Find max in a min heap.normal search in the complete list. There is one more optimization you can search from the mid of the array at index N/2
- What is the worst-case time complexity of finding the largest item in a min-heap?
- What is the worst-case time complexity of building a heap by insertion?
- Is a heap full or complete binary tree?
- What is the worst time runtime Complexity of sorting an array of N elements using heapsort?
- In given sequence of numbers: 1, 2, 3, 4, 5, 6, 7, 8, 9a. Draw a binary Min-heap by inserting the above numbers one by oneb. Also draw the tree that will be formed after calling Dequeue() on this heap
- In given sequence of numbers: 1, 2, 3, 4, 5, 6, 7, 8, 9a. Draw a binary Max-heap by inserting the above numbers one by oneb. Also draw the tree that will be formed after calling Dequeue() on this heap
- In given list: [3, 9, 5, 4, 8, 1, 5, 2, 7, 6]. Apply heapify over this to make a min heap and sort the elements in decreasing order?
- In Heap-Sort once a root element has been put in its final position, how much time, does it take to re-heapify the array so that the next removal can take place? In other words, what is the Time
- What do you think the overall Time Complexity for heapsort is? Why do you feel this way?
- Design a number (ID) generator system that generates numbers between 0-99999999 (8-digits).The system should support two functions:a. int getNumber();b. boolean requestNumber();getNumber() function
- In given large string, find the most occurring words in the string. What is the Time Complexity of the above solution?a. Create a Hashtable which will keep track of b. Iterate through the string and
- In the above question, What if you are given whole work of OSCAR WILDE, most popular playwrights in the early 1890s.a. Who knows how many books are there, let us assume there is a lot and we cannot
- In the above question, What if we want to find the most common PHRASE in his writings.We can keep Hash-Table and do the same process of the 2nd and 3rd problems.Question 3In the above question, What
- Write a hashing algorithm for strings. Use Horner's method public static int hornerHash (char[] key, int tableSize) { int size = key. Length; int h = 0;
- Pick two data structures to use in implementing a Map. Describe lookup, insert, & delete operations. Give time & Space Complexity for each.Give pros & cons for each.a) Linked List I. Insert is
- In the various path-finding algorithms, we have created a path array that just stores immediate parent of a node, print the complete path for it.
- All the functions are implemented considering as if the graph is represented by adjacency list. Write all those functions for graph representation as adjacency matrix.
- In a given start string, end string and a set of strings, find if there exists a path between the start string and end string via the set of strings.A path exists if we can get from start string to
- In given string, find the longest substring without reputed characters.
- Serialize a collection of string into a single string and de serializes the string into that collection of strings.
- Write a smart input function, which takes 20 characters as input from the user. Without cutting some word. User input: "Harry Potter must not go" First 20 chars: "Harry Potter must no" Smart input:
- Write a code that find if a string is palindrome and it should return true for below inputs too. Stella won no wallets. No, it is open on one position. Rise to vote, Sir. Won't lovers revolt now?
- Write an ASCII to integer function, which ignore the non-integral character and give the integer. For example, if the input is “12AS5” it should return 125.
- Write code that would parse a Bash brace expansion.Example: the expression "(a, b, c) d, e" and would give output all the possible strings: ad, bd, cd, e
- In given string write a function to return the length of the longest substring with only unique characters.
- Replace all occurrences of %20 with ' '.E.g. Input: www.Hello%20World.com Output: www.Hello World.com
- Write an expansion function that will take an input string like"1..5,8,11..14,18,20,26..30" and will print"1,2,3,4,5,8,11,12,13,14,18,20,26,27,28,29,30"
- Suppose you have a string like "Thisisasentence". Write a function that would separate these words. Moreover, will print whole sentence with spaces.
- In given three string str1, str2 and str3. Write a complement function to find the smallest sub-sequence in str1 which contains all the characters in str2 and but not those in str3.
- In given two strings A and B, find whether any anagram of string A is a sub string of string B.For eg: If A = xyz and B = afdgzyxksldfm then the program should return true.
- In given string, find whether it contains any permutation of another string. For example, given "abcdefgh" and "ba", the function should return true, because "abcdefgh" has substring "ab", which is a
- In give algorithm which removes the occurrence of “a” by “bc” from a string? The algorithm must be in-place.
- In given string "1010101010" in base2 convert it into string with base4.Do not use an extra space.
- In Binary Search tree to store strings, delete() function is not implemented, implement it.
- If you implement delete() function, then you need to make changes in find() function. Do the needful.
- Convert an infix expression to prefix expression.Reverse given expression, Apply infix to postfix, and then reverse the expression again.Function to convert infix expression to postfix expression.
- Implement queue using dynamic memory allocation, such that the implementation should follow the following constraints.a. The user should use memory allocation from the heap using new operator. In
- Implement stack using a queue. Write a program for this problem. You can use just one queue.A queue is a First-In-First-Out (FIFO) kind of data structure. The element that is added to the queue first
- Write a function print depth first in a binary tree without using system stack you may want to keep another element to tree node like visited flag.
- Isomorphic: two trees are isomorphic if they have the same shape, it does not matter what the value is. Write a program to find if two given tree are isomorphic or not.
- The height of a Binary Search Tree with n nodes in the worst case?o O(n * log n)o O(n)o O(logn)o O(1)
- Find nth smallest element in a binary search tree.Nth in order in a binary tree.
- Find the floor value of key that is inside a BST.
- What is the worst-case time complexity of deleteMin in a min-heap?
- In given sequence of numbers: 3, 9, 5, 4, 8, 1, 5, 2, 7, 6. Construct a Min-heap by calling Create Heap function. PriorityQueue pq = new PriorityQueue (arr, false);
- Given an array, sort elements in the order of their frequency. First, the frequency of various elements of array is calculated by adding it to HashTable. Then sorting of the new data structures with
- Check whether a given Binary Tree is Complete or not o In a complete binary tree, every level except the last one is completely filled. All nodes in the left are filled first, then the right one. 21
- Check whether a given Binary Tree is Full/ Strictly binary tree or not.The full binary tree is a binary tree in which each node has zero or two children. 3 5 00 8
- Check whether a given Binary Tree is Height-balanced Binary Tree or not. A height-balanced binary tree is a binary tree such that the left &right subtrees for any given node differs in height by
- The worst-case runtime Complexity of building a BST with n nodes O(n2)O(n * log n)O(n)O(logn)
- In given text file, print the words with their frequency. Now print the kth word in term of frequency.a) First solution may be you can use the sorting and return the kth element.b) Second solution:
- In given integer list that support three functions findMin, findMax, findMedian. Sort the array. public static void permutation(int [] arr, int i, int length) { if (length = i) { printArray(arr,
- Write a method to sort an array of strings so that all the anagrams are next to each other. a) Loop through the array.b) For each word, sort the characters and add it to the hash map with keys as
- Find max in sorted rotated list. //Sorts a given list by selection sort //Input: An array A[0..n-1] of orderable elements //Output: List A[0..n-1] sorted in ascending order Algorithm SelectionSort
- Find kth Smallest Element in the Union of Two Sorted Lists. //Sorts a given list by selection sort //Input: An array A[0..n-1] of orderable elements //Output: List A[ 0..n-1] sorted in ascending
- Insert an element at kth position from the end of linked list. Return true if success and if list is not long enough, then return -1. Take a pointer of head and then advance it by K steps forward,
- Consider there is a loop in a linked list, Write a program to remove loop if there is a loop in this linked list. //Sorts a given list by selection sort //Input: An array A[0..n-1] of orderable
- Given two linked list head-pointer and they meet at some point and need to find the point of intersection. However, in place of the end of both the linked list to be a null pointer there is a loop.
- Write an HTML opening tag and closing tag-matching program.parenthesis matching.
- Write a palindrome matching function, which ignores characters other than English alphabet and digits. String "Madam, I'm Adam." should return true.
- Implement the below function for the queue:a. IsEmpty: This is left as an exercise for the user. Take a variable, which will take care of the size of a queue if the value of that variable is zero,
- Write a CompStack() function which takes pointer to two stack as an argument and return true or false depending upon whether all the elements of the stack are equal or not. You are given isEqual(int,
- Write pros and cons of Heap-Sort, Merge-Sort and Quick-Sort.
- In the problem 9, what if there are repetitions allowed and you need to find the index of the first occurrence of the element in the rotated-sorted list.problem 9Write pros and cons of Heap-Sort,
- Given an array contain 0’s and 1’s, sort the array such that all the 0’s come before 1’s. //Sorts a given list by selection sort //Input: An array A[0..n-1] of orderable elements. //Output:
- In given list of n elements, we need to find the first repeated element.Which of the following methods will work for us. If a method works, then implement it.• Brute force exhaustive search.• Use
- In given list of –ve and +ve numbers, write a program to separate –ve numbers from the +ve numbers. //Sorts a given list by selection sort //Input: An array A[0..n-1] of orderable elements.
- In given list of 1’s and 0’s, write a program to separate 0’s from 1’s. //Sorts a given list by selection sort //Input: An array A[0..n-1] of orderable elements. //Output: List A[0..n-1]
- In given list of 0’s, 1’s and 2’s, write a program to separate 0’s, 1’s and 2’s. //Sorts a given list by selection sort //Input: An array A[0..n-1] of orderable elements //Output: List
- In given list whose elements is monotonically increasing with both negative and positive numbers. Write an algorithm to find the point at which list becomes positive. //Sorts a given list by
- In a sorted list, find a number. If found then return the index if not found then insert into the array. // Sorts a given list by selection sort //Input: An array A[0..n-1] of orderable elements.
- Find min in the sorted rotated list. //Sorts a given list by selection sort //Input: An array A[0..n-1] of orderable elements. //Output: List A[ 0..n-1] sorted in ascending order Algorithm
- Insert an element at kth position from the start of linked list. Return true if success and if list is not long enough, then return -1.Take a pointer of head and then advance it by K steps forward,
- We were supposed to write the complete code for the addition of polynomials using Linked Lists. This takes time if you do not have it by heart, so revise it well. //Sorts a given list by selection
- In given two linked lists. We have to find whether the data in one is reverse that of data in another. No extra space should be used and traverse the linked lists only once. //Sorts a given list by
- In a huge linked list, you are given a pointer to some middle node. Write a program to remove this node.Copy the values of next node to current node. Then remove next node. //Sorts a given list by