Question
Unfortunately in python language there is a limit for integer numbers. For example the largest long integer for my computer is 2147483647. There are at
Unfortunately in python language there is a limit for integer numbers. For example the largest long integer for my computer is 2147483647. There are at most 10-digits I can have. But sometimes we need larger numbers beyond the limit.
We can have larger numbers if we store integers in linked lists instead of fixed addressable memory locations. In a linked list each node stores one digit of the number. This way we can store as big integers as the memory of the computer allows.
For example the following list represents a 6-digit number: 153074:
1 |
5 |
0 |
4 |
3 |
7 |
|
We can store as big numbers as the memory of our computer allow us.
Write an application that we can store very big integers. Your application should provide an interface for creating,updating and freeing large integers. Therefore you need createBigInt, updateBigInt and freeBigInt functions.
We need to allow two arithmetic operators. The project has two parts for implementing these. If you complete the mandatory part your project will be evaluated over 100 points. However you may get up to 150 points if you improve the project with extras.
The mandatory part requires the following:
You need to implement + and = operators. You can refer to them as addBigInt and equalBigInt in your interface which can be used for adding or assigning big integers. You are free to include any additional functions into your application.
You can represent your integers with a linked list. The type of the linked list is completely up to you. You can prefer a double linked list.
For sake of simplicity the input integers will be assumed having at most 50 digits. (Note that the output can be longer than this.)
The Input File
In the input file, there will be a single infix expression with at most 10 tokens.
The Output File
In the result should be written to an ouput file named output.txt to the same directory of the input file.
Optional Part: (30 points more) If you do the optional part of the project you will get 30 points more. If you complete the following extras you will get bonus points for your work.
- Including * (multiplyBigInt)
- Including infix to postfix conversion and postfix evaluation for the input ( We can disscuss these in the class)
Extra Bonuses (20 points more): If you complete mandatory and optional part you can still have bonus points if you include the following features.
- Including - (subtract BigInt)
- Support for negative BigInt
- Power support
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started