Develop the algorithm as a module

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

Discussion Overview

The discussion revolves around developing a search algorithm as a module that can find an integer in an array based on a given specification. The focus is on designing the algorithm using pseudo code notation, with participants exploring various aspects of the task, including definitions and coding approaches.

Discussion Character

  • Exploratory
  • Technical explanation
  • Homework-related

Main Points Raised

  • One participant outlines a specification for the search module, defining the conditions under which a number is found in an array.
  • Another participant seeks clarification on what constitutes a "module" in this context.
  • A suggestion is made to iterate through the array to check for the presence of the number, moving sequentially through the elements.
  • A request is made for an initial coding attempt to better understand the implementation of the search algorithm.
  • Participants express confusion regarding the pseudo-code style being referenced and request clarification on it.
  • One participant offers to assist by explaining a traditional approach to searching through a list, suggesting that control structures may be relevant to the solution.

Areas of Agreement / Disagreement

There is no consensus on the implementation details of the search algorithm, and multiple viewpoints regarding the understanding of pseudo-code and the concept of a module are present.

Contextual Notes

Participants express varying levels of understanding regarding pseudo-code and control structures, indicating potential gaps in knowledge that may affect the discussion.

Who May Find This Useful

This discussion may be useful for individuals interested in algorithm design, programming concepts, and those seeking to understand search algorithms in a modular context.

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