CRJ troll GJD algorithm pseudo code

Source: Internet
Author: User

For the convenience of memory, so given as code

Defined

Reset (N)

Flag=1,len = 0

Assigned Value (LL):

While a is not zero

N[i] = A[i] Bits

Len = i

Assign value (String a):

Len = A.len

for 0 Len

N[i] = a[len-1-i]-' 0 '

Addition:

Len = MaxLen (A, b) + 1

TP = 0;

For 0, N

N[i] = A[i]+b[i] + TP

TP = N[i]/10

N[i]%= 10

Go leading Zero

Subtraction:

if (a < b) Exchange, negative output

Len = MaxLen (A, B)

For 0, N

N[i] = A[i]-b[i]

If N[i] < 0 then n[i + 1]--, n[i] + 10;

Go leading Zero

Multiplication:

Len = Lena+lenb

For i = 1-Lena

For j = 1-LenB

N[i + j] = na[i] * Nb[j]

N[i + j + 1] = N[i + j]/10

N[i + j]%= 10

Go leading Zero

Less than comparison:

If Len is not equal then Len Small

else for 0 Len

If a[i] < B[i] then a small

Output:

If negative then output-

else for len-1, 0 out N[i]

CRJ troll GJD algorithm pseudo code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.