Finding the Largest Value with Little Man Computer

  • Thread starter buttonmutton
  • Start date
  • Tags
    Computer
In summary, the conversation discusses how to write a Little Man program that can accept an indefinite number of input values and outputs the largest value. There is no need to store all the input values and instead, the program can continuously compare the input values to find the largest one. There is no specific limit to the number of input values that can be accepted. The purpose of storing input values without limit is unclear and unnecessary for this program.
  • #1
buttonmutton
4
0
How do you write a Little Man program which accepts an indefinite number of input values given the conditions that the output value has to be the largest of the input values.

Is it just by entering and storing input or otherwise?
 
Technology news on Phys.org
  • #2
How much would you need to store in that case?
 
  • #3
there's no limit
 
  • #4
I think you misunderstood verty's post. You don't need to store all the input.
 
  • #5
Then how do you write it?
 
  • #6
Any suggestions?
 
  • #7
Please give a detailed rationale why would you would need to store stuff without limit. What would you do with that stored stuff anyway?
 

1. How does the Little Man Computer (LMC) find the largest value?

The LMC uses a simple algorithm to find the largest value in a set of data. It compares each number in the set to the current largest value and replaces it if the new number is greater. This process is repeated until all numbers have been checked, resulting in the largest value being found.

2. What is the purpose of finding the largest value with LMC?

Finding the largest value with LMC can be used in a variety of applications, such as sorting data or finding the maximum value in a set of numbers. It is a fundamental problem in computer science and understanding how to solve it with LMC can help in developing more complex algorithms.

3. What are the limitations of using LMC to find the largest value?

LMC is a simplified model of a computer and has limited capabilities. It can only process a finite number of data and has a limited memory size. This means that it may not be suitable for finding the largest value in large sets of data or for more complex tasks.

4. Can LMC find the largest value in negative numbers?

Yes, LMC can find the largest value in negative numbers. The algorithm for finding the largest value does not differentiate between positive and negative numbers, it simply compares the magnitude of each number.

5. How can I test my LMC program for finding the largest value?

You can use a simulator or emulator to test your LMC program for finding the largest value. These tools allow you to input data and run the program step by step, making it easier to identify any errors or bugs in your code. You can also use a pen and paper to manually go through the algorithm and check if the largest value is correctly identified.

Similar threads

  • Programming and Computer Science
Replies
29
Views
1K
  • Programming and Computer Science
Replies
17
Views
2K
  • Programming and Computer Science
Replies
4
Views
500
  • Programming and Computer Science
Replies
1
Views
652
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
22
Views
872
  • Programming and Computer Science
Replies
8
Views
1K
  • Programming and Computer Science
Replies
5
Views
3K
  • Programming and Computer Science
Replies
5
Views
22K
Back
Top