I came across this problem about In-order Traversal of binary search tree without using a stack or recursion. Hint says to assume that testing of pointers for equality is a legitimate operation.I'm stuck finding the solution to this problem. Please give me some direction. I'm not looking for the code. Just give me the right direction.
@Kartik........Which data structre is used in Window search()............Which data structure is used by GOOGLE in GOOGLE SEARCH ENGINE.............?????????
may i get more elaborated description of what data structures should be used to make a text editor
Design a layer in front of a system which cache the last n requests and the responses to them from the system. what data structure would you use to implement the cache in the later to support following operations. [a] When a request comes look it up in the cache and if it hits then return the response from here and do not pass the request to the system [b] If the request is not found in the cache then pass it on to the system [c] Since cache can only store the last n request...
1.program to implement two stacks of integers using a single array. The (Single) array will have two stack pointers (SP). The first stack pointer will manage all even numbers. This SP will initially be at the beginning of the array. The second stack pointer will manage all odd numbers and shall initially point to the end of the array. Your program should use the appropriate stack pointer depending on whether the number is odd or even to push into the stack. For popping ask the user whether th...
implement a stack using one queue
reverse a stack using one queue
copy contents of a stack s1 to another stack s2 using one temporary stack
Problem: Merge two BSTs .
#include<iostream> class node{ public: int d; node* l; node* r; node(int x):d(x),l(0),r(0){} }; void add(int x,node *&a){//lower or equal value to the left BST if(!a)a=new node(x); else if(x>a->d)add(x,a->r); else add(x,a->l); } void print(node *a){ if(a){ print(a->l); std::cout<<a->d<<" "; print(a->r); } } void merge(node *&a,node *&b){//merge b into a if(b==0)return; els...
Which one of the following array sequences forms a heap?
a) 23,17,14,6,13,10,1,12,7,5 b) 23,17,14,6,13,10,1,5,7,12 c) 23,17,14,7,13,10,1,5,6,12 d) 23,17,14,7,13,10,1,12,5,7
Could you please explain how do we know which sequence forms a heap?
Design a DS having following operation : 1. insert(s,x) : insert element x in set s 2. delete_max_half() : delete largest ceiling( s/2) elements
condition: a sequence of m above operation take O(m) time i.e amortize cost is O(1) for both operation ... coremen question
A n*n matrix contains 1's and 0's . write a algorithm to print a sub matrix that contains only 1's and it should contains maximum number of 1's compare to other sub matrix contains only 1's... for example INPUT: 0 1 1 0 0 1 1 0 1 0 1 1 OUTPUT: 11 11
WHEN TO USE STACK,QUEUE,TREE,LINKED LIST DATASTRUCTURE??WE NORMALLY DO PROGRAMS ON LINKED LISTS//say swap nodes,reverse,kth from last,tree programs.. BUT WHAT IS THE PRACTICAL USE ON TOTAYs IT WORLD???
given a m*m matrix contains a character each find the maximum length of a meaningful word eg: input: [i]l[/i] b c d [i] e[/i] f g h [i]s[/i] j k l [i]s[/i] [i]e[/i][i] r[/i] p
output: lesser
provided search can be done by moving a step (top,left,right or bottom).
implement a stack which will support three additional operations in addition to push and pop: 1.peekLowestElement()//return the lowest element in the stack without removing it from the stack 2.peekHighestElement()//return the highset element in the stack without removing it from the stack 3.peekMiddleElement()//return the (size/2 +1)th lowest element in the stack without removing it from the stack.
faster is better.Assume every method will be called with equal freq...
RSS link for this tag
You must log in to post.
Register or log in:
Lost Password?