Hashing Problem Homework: Generate Hash Function from Table

  • Thread starter gruba
  • Start date
  • Tags
    Algorithm
In summary, the conversation discusses the problem of finding an algorithm to determine the order of machines needed to complete the manufacturing process of a car without interruptions. This involves using a hash function to generate a sequence of machines along the production line, with the goal of satisfying the preconditions listed in the table for each part. The given table also includes lists that cause interruptions in the process, further complicating the algorithm.
  • #1
gruba
206
1

Homework Statement


In a factory, machines are making cars (1-n) along the production line. One machine is making one part on the existing construction (part 1 is made by machine 1,...). Installation order of some parts is not important, but some parts have to be installed before others. Engineers have put together a dependence list for car parts as a table:
1 2
2 4
3 2,1
4
5 3,8,7,6
6 4,7
7 3,8
8 4,3,1


where the first column represents parts (1-8), and the second column represents preconditions for installment of each part. That is the list of parts (second column) whose installment must be done before the installment of current part (first column).

For each given list (second column), find the order of machines along the production line such that the manufacturing process of a car is done without interruptions, if such order exists. Also, find lists from the given table that give orders with interruptions.

Design an algorithm for this problem.
Show the final order of machines along the production line, if it exists.

Homework Equations


-Hash functions
-Hash tables

The Attempt at a Solution



For each part (1-8, first column) we have to find a hash function without collisions that satisfies the second column in the table (if possible).

This is obviously the reversed process from generating hash table from given hash function.

I have found that the only possible order of machines along with production line, such that there is no interruption in the process is:
[tex]4,2,1,3,8,7,6,5[/tex]

Also, lists [itex]4-7,4-3-1[/itex] are causing an interruption (collision) in a process.

Question: How can we generate hash function from hash table (reversed algorithm from standard, where hash function is given - create hash table)?
 
Last edited:
Physics news on Phys.org
  • #2
I do not understand how the problem of finding an algorithm for this has anything to do with hash functions. Can you explain what you mean by the hash function "satisfying" the second column?
 
  • #3
haruspex said:
I do not understand how the problem of finding an algorithm for this has anything to do with hash functions. Can you explain what you mean by the hash function "satisfying" the second column?
Maybe I have misunderstood the problem. I think that for each given list (second column), the order of machines along the production line such that the manufacturing process of a car is done without interruptions, if such order exists, is a hash function. Sequence that I gave in the original post should be generated by some function, right?
 
  • #4
gruba said:
the order of machines ... is a hash function
In what way can the order of a sequence be a function? A function of what? What are we hashing and what is the output?
 

What is a hash function and why is it important?

A hash function is a mathematical function that takes in data of any size and outputs a fixed-size string of characters. It is important because it allows for efficient storage and retrieval of data by mapping inputs to unique outputs, making data organization and searching much faster.

How is a hash function created from a table?

A hash function is created by taking the data from each row in the table and applying a mathematical algorithm to it. This algorithm should produce a unique output for each input, ensuring that the hash function is consistent and efficient.

What are the main properties of a good hash function?

A good hash function should have the following properties:

  • Consistency: the same input should always produce the same output
  • Efficiency: it should be computationally efficient
  • Uniformity: the outputs should be evenly distributed
  • Collision resistance: it should be difficult to find two inputs that produce the same output

What can cause collisions in a hash function?

Collisions can occur when two different inputs produce the same output in a hash function. This can happen if the hash function is not designed properly or if the input data is not diverse enough.

How can collisions be prevented in a hash function?

Collisions can be prevented by carefully designing the hash function with a good algorithm and by ensuring that the input data is diverse enough to produce unique outputs. Additionally, using techniques such as chaining or open addressing can help handle collisions if they do occur.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
4
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
944
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Programming and Computer Science
Replies
30
Views
4K
Replies
8
Views
838
  • Beyond the Standard Models
Replies
11
Views
1K
Replies
6
Views
1K
  • Precalculus Mathematics Homework Help
Replies
6
Views
2K
Back
Top