Write a C program to sort a stack in ascending order. You should not
make any assumptions about how the stack is implemented. The following
are the only
functions that should be used to write this program:
Push | Pop | Top | IsEmpty | IsFull
The algorithm is O(N^2) and appears below.
Do we have
a file contains lot of log information in the form of DD:MM:YY
HOURS: MINUTES:SECOND: random length text
GIven 2 dates, print out the lines in the file between these 2 dates.
Also optimize solution because the file may be huge and so dont go
line by line.
--
You received this message
What about a quick sort O(log n)
void sort_stack(Stack *src, Stack *dst)
{
if(! src-IsEmpty() )
{
Stack smaller, larger;
int pivot = src-Pop();
while(! src-IsEmpty() )
{
int tmp = src-Pop();
dp[i][0]=1 implies that there is 1 combination which will ensure that the
number of A's and B's is same in the string.
eg AAA is not a valid string
dp[0][0]=1 doesnot satisfy property 1 either
with this algo and tring length 4(possible strings AABB, ABAB)
a[i][j] will look like
1 1 1
0 1 0
0
It can be solved with trie
On Sun, Jul 18, 2010 at 10:28 AM, Ashish Goel ashg...@gmail.com wrote:
dp[i][0]=1 implies that there is 1 combination which will ensure that the
number of A's and B's is same in the string.
eg AAA is not a valid string
dp[0][0]=1 doesnot satisfy property 1 either