Develop the algorithm as a module

In summary, the conversation discusses the development of a search algorithm to find an integer number within a given array, according to the given specification. The module, named "search module", is designed to search through the array until the number is found. The algorithm should use pseudo code notation and utilize control structures to efficiently search through the array.
  • #1
teng125
416
0
Consider the following specification:
pre n >= 1
post search module(a, n, number) = FOUND(a, number)
reads a, n, number
changes -
mem -

Remark: Let i be an integer number. Then, FOUND = 0 iff a does not contain
number and FOUND = i iff a = number. search module is the name of the module
to be developed.
Design a search algorithm that searches for an integer number and that suffices the
above specification. Develop the algorithm as a module. Use the pseudo code notation



smby pls help
thanx
 
Physics news on Phys.org
  • #2
What are your thoughts? Also, what is a "module"?
 
Last edited:
  • #3
try to search through the arrays [a] to see whether the number is found or not.If not,proceeds to the second position
 
  • #4
So can you please show us your first attempt at coding this up?
 
  • #5
Also, could you please post a brief reference to the pseudo-code style that you are using? I'm not getting it.
 
  • #6
I do not understand the pseudocode very well either but I can help...

So you got an integer array. And you're looking for a certain number in the array. So this module is suppose to take care of that.

How would you traditionally sort through a list of things if you were looking for a certain thing in the list? You would start at the top of the list and keep going down until you found the thing you were looking for. Has your teacher taught you anything about control structures yet? If so, then you should be able to figure it out from here.
 

1. What is an algorithm module?

An algorithm module is a set of instructions or steps that are designed to solve a specific problem or perform a specific task. It is a self-contained unit that can be easily integrated into larger programs.

2. How is an algorithm module developed?

An algorithm module is developed by breaking down a complex problem into smaller, more manageable steps. These steps are then translated into a series of instructions that can be implemented in a programming language.

3. How is an algorithm module different from a regular program?

An algorithm module is different from a regular program in that it is designed to perform a specific task and can be easily integrated into larger programs. Regular programs, on the other hand, are usually more complex and have a wider range of functionalities.

4. What are the benefits of using an algorithm module?

Using an algorithm module offers several benefits, including increased efficiency, modularity, and reusability. Since the module is self-contained, it can be easily reused in different programs, making the development process faster and more streamlined.

5. How can I test the effectiveness of an algorithm module?

The effectiveness of an algorithm module can be tested by running it through different test cases and analyzing the results. This can help identify any potential errors or flaws in the module and allow for improvements to be made before integration into larger programs.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
Replies
2
Views
881
  • Programming and Computer Science
Replies
2
Views
884
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Programming and Computer Science
Replies
29
Views
1K
  • Programming and Computer Science
Replies
25
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
9
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
2K
Back
Top