| |

VerySource

 Forgot password?
 Register
Search
View: 12|Reply: 6

How to determine whether two operation expressions (strings) are equivalent, such as a * (b + c) and a * b + a * c are e

[Copy link]

1

Threads

3

Posts

3

Credits

Newbie

Rank: 1

Credits
3

 China

Post time: 2020-2-16 14:00:01
| Show all posts |Read mode
How to determine whether two operation expressions (strings) are equivalent, for example, a * (b + c) is equivalent to a * b + a * c
Reply

Use magic Report

2

Threads

5

Posts

6

Credits

Newbie

Rank: 1

Credits
6

 China

Post time: 2020-4-18 13:30:01
| Show all posts
Just substitute the value a few more times.
Reply

Use magic Report

0

Threads

6

Posts

7

Credits

Newbie

Rank: 1

Credits
7

 China

Post time: 2020-5-21 11:30:01
| Show all posts
I do n’t know if your question involves string manipulation. If this is the case, I have an idea:
1. Suppose you have N strings, they are the same, but we can find a signature for them. In the example in this article, we can think of "a * b + a * c" as their signature.
2. Convert all the strings according to a certain strategy. If their conversion result and label are consistent, they are considered equivalent, otherwise they are not equivalent.
The idea is to find inspiration from the algorithms that look for "anagrams". You can search for the specific algorithm.
Reply

Use magic Report

0

Threads

9

Posts

5

Credits

Newbie

Rank: 1

Credits
5

 China

Post time: 2020-7-3 13:15:01
| Show all posts
Use the method of compilation principle!
Reply

Use magic Report

0

Threads

1

Posts

2

Credits

Newbie

Rank: 1

Credits
2

 China

Post time: 2020-7-6 16:30:02
| Show all posts
a*(b+c) is equivalent to a*b+a*c ie a*(b+c)-(a*b+a*c)=0

Invert a*(b+c)-(a*b+a*c) to Poland, and then reduce the polynomial to see if it can be reset to zero

Considering division is a bit more troublesome :), I used to write a practice while learning C++
Reply

Use magic Report

1

Threads

3

Posts

3

Credits

Newbie

Rank: 1

Credits
3

 China

 Author| Post time: Yesterday 21:00
| Show all posts
Reply

Use magic Report

1

Threads

3

Posts

3

Credits

Newbie

Rank: 1

Credits
3

 China

 Author| Post time: Yesterday 21:15
| Show all posts
to zhengwei198422:
a*(b+c)-(a*b+a*c) reverse Poland should be:
abc+*ab*ac*+-bar, how to operate the polynomial simplification in the next step, I compare the dishes
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2020|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list