Browsing the topic Misc
Question 1 Consider the following recursive C function. Let len be the length of the string s and num be the number of characters printed on the screen
Read More »Subset sum problem is to find subset of elements that are selected from a given set whose sum adds up to a given number K. We are considering the set contains non-negative values. It is assumed that the input set is unique (no duplicates are presented).
Read More »Design and Implement Special Stack Data Structure | Added Space Optimized Version
16 Comments | Filed under MiscQuestion: Design a Data Structure SpecialStack that supports all the stack operations like push(), pop(), isEmpty(), isFull() and an additional operation getMin()
Read More »Given a positive number n, write a function isMultipleof5(int n) that returns true if n is multiple of 5, otherwise false. You are not allowed to use % and / operators.
Read More »Question: We have discussed Naive String matching algorithm here. Consider a situation where all characters of pattern are different.
Read More »We have discussed Knight’s tour and Rat in a Maze problems in Set 1 and Set 2 respectively. Let us discuss N Queen as another example problem that can be solved using Backtracking.
Read More »We have discussed Backtracking and Knight’s tour problem in Set 1. Let us discuss Rat in a Maze as another example problem that can be solved using Backtracking.
Read More »Backtracking is an algorithmic paradigm that tries different solutions until finds a solution that “works”. Problems which are typically solved using backtracking technique have following property in common.
Read More »Continuing further on dynamic programming series, edit distance is an interesting algorithm.
Read More »What is the time complexity of following function fun()? Assume that log(x) returns log value in base 2.
Read More »We have discussed Overlapping Subproblems and Optimal Substructure properties in Set 1 and Set 2 respectively.
Read More »We have discussed Overlapping Subproblems and Optimal Substructure properties in Set 1 and Set 2 respectively.
Read More »As we discussed in Set 1, following are the two main properties of a problem that suggest that the given problem can be solved using Dynamic programming.
Read More »Dynamic Programming is an algorithmic paradigm that solves a given complex problem by breaking it into subproblems and stores the results of subproblems to avoid computing the same results again.
Read More »Given a text txt[0..n-1] and a pattern pat[0..m-1], write a function search(char pat[], char txt[]) that prints all occurrences of pat[] in txt[]. You may assume that n > m.
Read More »Given a text txt[0..n-1] and a pattern pat[0..m-1], write a function search(char pat[], char txt[]) that prints all occurrences of pat[] in txt[]. You may assume that n > m.
Read More »Given a text txt[0..n-1] and a pattern pat[0..m-1], write a function search(char pat[], char txt[]) that prints all occurrences of pat[] in txt[]. You may assume that n > m.
Read More »Depth-first search (DFS) is an algorithm (or technique) for traversing a graph.
Read More »Question 1 Predict the output of following program. What does the following fun() do in general?
Read More »The Fibonacci numbers are the numbers in the following integer sequence.
Read More »Minimum Spanning Tree (MST) problem: Given connected graph G with positive edge weights, find a min weight set of edges that connects all of the vertices.
Read More »The problem of sorting can be viewed as following.
Read More »Queue is used when things don’t have to be processed immediatly, but have to be processed in First In First Out order like Breadth First Search. This property of Queue makes it also useful in following kind of scenarios.
Read More »Heap Data Structure is generally taught with Heapsort. Heapsort algorithm has limited uses because Quicksort is better in practice. Nevertheless, the Heap data structure itself is enormously used. Following are some uses other than Heapsort.
Read More »A sorting algorithm is said to be stable if two objects with equal keys appear in the same order in sorted output as they appear in the input unsorted array.
Read More »