Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Printing Pyramid Puzzle

Tags:

algorithm

Derive an algorithm for printing a pyramid with all possible combination such that lightest and smallest person lie on top of pyramid and heaviest and biggest person as a base

For Example :

Person A 80kg 140 cms

Person B 90kg 150 cms

Person C 100kg 160 cms

Person D 100kg 170 cms

Person E 150kg 180 cms

Person F 160kg 185 cms

  A
 B C
D E F

Note: Person with height and weight larger than other person cannot lie on top of that person Its not mandotory for every person to be part of pyramid structure

like image 412
Ranu Mandan Avatar asked Jan 25 '12 09:01

Ranu Mandan


People also ask

Can you 3D print with bamboo?

Because of its heat resistance, hardness, toughness and impact strength, it has the potential to be used as a valuable part of many 3D printing applications – not to mention that it produces an attractive wood-like finish. There is a great need for more sustainable 3D printing materials, and bamboo is one solution.

Can you print a sphere?

Yes, you can 3D print a sphere without supports by splitting the sphere into two halves, then joining them together afterwards, simply by gluing it. You can split the model by editing it in a CAD software, or simply by lowering the sphere into the bed by half of its height, then duplicating it for the second half.


1 Answers

Here's a rough idea.

Construct a graph in a way that an directed edge goes from node X to Y if X > Y (both components) and there's no such Z that X > Z > Y, for your example

       / C \
F -> E       B -> A
       \ D /

Then construct all trees of hight 1, and recursively construct the rest like so:

Mark all used nodes in the tree (initially, just one node) For putting a person X under another 2 persons Y Z you can only use persons that in the graph are under Y Z

use all permutations and recursively repeat until you can construct no more

like image 175
penelope Avatar answered Sep 22 '22 23:09

penelope