Develop the algorithm as a module

  • Thread starter Thread starter teng125
  • Start date Start date
  • Tags Tags
    Algorithm module
Click For Summary
SUMMARY

The discussion centers on developing a search module that adheres to the specified preconditions and postconditions for an integer array. The module, named "search module," must determine if a given number exists within the array and return its index or indicate absence. Participants emphasize the importance of using pseudo code for clarity and suggest leveraging control structures to implement the search algorithm effectively.

PREREQUISITES
  • Understanding of pseudo code notation
  • Familiarity with control structures in programming
  • Basic knowledge of array data structures
  • Experience with algorithm design principles
NEXT STEPS
  • Research how to implement linear search algorithms
  • Learn about pseudo code conventions and best practices
  • Explore array manipulation techniques in programming languages
  • Study control structures such as loops and conditionals
USEFUL FOR

Students learning algorithm design, software developers creating search functionalities, and educators teaching programming concepts related to arrays and modules.

teng125
Messages
416
Reaction score
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
What are your thoughts? Also, what is a "module"?
 
Last edited:
try to search through the arrays [a] to see whether the number is found or not.If not,proceeds to the second position
 
So can you please show us your first attempt at coding this up?
 
Also, could you please post a brief reference to the pseudo-code style that you are using? I'm not getting it.
 
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.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
2K
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
2
Views
3K
Replies
2
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 17 ·
Replies
17
Views
6K
  • · Replies 4 ·
Replies
4
Views
3K