if the given tree is complete B tree then its similar to the mirror tree
problem
On Fri, Sep 6, 2013 at 3:38 AM, subrat kumar prasad wrote:
> bool check_palin(vector v){
>
> vector v1(v);
> reverse(v1.begin(),v1.end());
>
> for(int i = 0;i if(v[i] != v1[i])
> return
1. take the nodes at current level i in an array.
2. check if the current level is palindrome.
On Mon, Sep 2, 2013 at 3:25 PM, Bhawin wrote:
> Given a binary tree design an algorithm to check if the tree is a
> palindrome tree or not.
>
> Palindromic tree: String formed by characters at each l
bool check_palin(vector v){
vector v1(v);
reverse(v1.begin(),v1.end());
for(int i = 0;i q;
q.push(root);
q.push(NULL);
vector v;
while(!q.empty()){
while(q.front()){
node *l = q.front();
q.pop();
v.push_back(l->ch);
Given a binary tree design an algorithm to check if the tree is a
palindrome tree or not.
Palindromic tree: String formed by characters at each level should be
palindrome. Tree need not to be a complete BT.
e.g.
a
You are given a large string. You need to cut the string into chunks such
that each substring that you get is a palindrome. Remember that each 1
length string is always a palindrome. You need to find the minimum number of
cuts that you need to make such that each substring is a palindrome.
--
Yo
Hi,
Here is the simple solution
unsigned int r = v; // r will be reversed bits of v; first get LSB of v
int s = sizeof(v) * CHAR_BIT - 1; // extra shift needed at end
for (v >>= 1; v; v >>= 1)
{
r <<= 1;
r |= v & 1;
On Wed, Dec 22, 2010 at 12:11 PM, mo...@ismu wrote:
>
>
> if x is a 32 bit number
> if((x&0x)==((x>>16)&0x)))
>x's bit pattern is a polyndrome
>
> @snehal :Do you want to consider binary representation of 5 as 101 or
..0101 ?
--
> You received this message because you
if x is a 32 bit number
if((x&0x)==((x>>16)&0x)))
x's bit pattern is a polyndrome
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this g
Algorithms to check if binary representation of a number is palindrome
or not
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
algo
the idea for O(|S|^2) is as follows
Let string be s[1..n]
p[i][j]=1 if s[i...j] is a palindrome
p[i][j]=0 otherwise.
we can precalculate table p[i][j] as follows..in O(|s|^2)
p[i][i]= 1
p[i][i+1]=1 if s[i]==s[i+1], 0 otherwise
for all others..
p[i][j]= (s[i]==s[j] && p[i+1][j-1]==1).
now le
how to do that in O(|s|^2)?
2010/11/16 anoop chaurasiya
> will O(|s|^2) dp workor u need something more efficient than that
>
>
> On Tue, Nov 16, 2010 at 1:51 PM, lichenga2404 wrote:
>
>> A palindrome is a string which is identical to itself in reverse
>> order. For example
>> \ABAAABA"
will O(|s|^2) dp workor u need something more efficient than that
On Tue, Nov 16, 2010 at 1:51 PM, lichenga2404 wrote:
> A palindrome is a string which is identical to itself in reverse
> order. For example
> \ABAAABA" is a palindrome. Given a string, we'd like to break it up
> into the s
A palindrome is a string which is identical to itself in reverse
order. For example
\ABAAABA" is a palindrome. Given a string, we'd like to break it up
into the small-
est possible number of palindromes. Of course, any one-character
string is a palindrome
so we can always break a length n string in
Here is code to find palindrome in linear time:
http://codepad.org/PMJzjpPJ
On Fri, Jun 18, 2010 at 5:28 AM, Chunyuan Ge wrote:
> good point, i am wrong, sorry
>
>
>
> On Fri, Jun 18, 2010 at 5:54 PM, Rohit Saraf
> wrote:
>
>> abcqwertycba
>>
>> So is abc a palindrome??
>> -
here's a linear time solution:
http://www.akalin.cx/2007/11/28/finding-the-longest-palindromic-substring-in-linear-time/
On Fri, Jun 18, 2010 at 4:58 PM, Chunyuan Ge wrote:
> good point, i am wrong, sorry
>
>
>
> On Fri, Jun 18, 2010 at 5:54 PM, Rohit Saraf
> wrote:
>
>> abcqwertycba
>>
>> So i
check this
http://www.akalin.cx/2007/11/28/finding-the-longest-palindromic-substring-in-linear-time/
On Fri, Jun 18, 2010 at 3:36 PM, Manzoor Ahmed wrote:
> What do you mean by origin string?
>
>
> On Fri, Jun 18, 2010 at 2:38 PM, Chunyuan Ge wrote:
>
>> Origin string a, reverse the string to g
good point, i am wrong, sorry
On Fri, Jun 18, 2010 at 5:54 PM, Rohit Saraf wrote:
> abcqwertycba
>
> So is abc a palindrome??
> --
> Rohit Saraf
> Second Year Undergraduate,
> Dept. of Computer Science and Engineering
> IIT Bombay
> http://www.cse
What do you mean by origin string?
On Fri, Jun 18, 2010 at 2:38 PM, Chunyuan Ge wrote:
> Origin string a, reverse the string to get b
> get the longest common string between a and b
>
> that's it.
>
> Chunyuan
>
>
> On Thu, Jun 17, 2010 at 8:38 PM, debajyotisarma > wrote:
>
>> Find the longest
abcqwertycba
So is abc a palindrome??
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT Bombay
http://www.cse.iitb.ac.in/~rohitfeb14
On Fri, Jun 18, 2010 at 3:08 PM, Chunyuan Ge wrote:
> Origin string a, reve
Origin string a, reverse the string to get b
get the longest common string between a and b
that's it.
Chunyuan
On Thu, Jun 17, 2010 at 8:38 PM, debajyotisarma
wrote:
> Find the longest palindrome in the given string.
> Minimum time-space complexity required
> (i have not solved it so don't kno
check two types of palindromes..
even and odd and as soon as u get one. just expand on both sides to get the
longest one..
even palindromes are
arr[i]==arr[i+1]
and odd palindromes are
arr[i]==arr[i=2]
On Fri, Jun 18, 2010 at 9:20 AM, Antony Vincent Pandian.S. <
sant...@gmail.com> wrote:
> I rem
I remember this question under discussion recently. Please check the
existing threads...
On 6/17/10, debajyotisarma wrote:
> Find the longest palindrome in the given string.
> Minimum time-space complexity required
> (i have not solved it so don't know what is min)
>
> --
> You received this mess
Find the longest palindrome in the given string.
Minimum time-space complexity required
(i have not solved it so don't know what is min)
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegrou
23 matches
Mail list logo