Algorithms: Puzzle called “Falling egg”

Assume you are given 2 eggs.
You have access to a 100-floors high building
Eggs can break if dropped from the first floor or may not even break if dropped from 100th floor.
Both eggs are identical.

You need to figure out the highest floor of a 100-storey building an egg can be dropped from without breaking.
The question is how many drops you need to make. You are allowed to break 2 eggs in the process Continue reading

Floyd’s Cycle-Finding Algorithm

If you want to check if your linked list is circular you can use  Floyd’s Cycle-Finding Algorithm aka Tortoise and the Hare Algorithm.

It’s quite efficient as It has O(n) complexity.
Continue reading

Create new batch characteristics with values checked and suggested by a function module

SAPIn this example I’ll try to show you how to create new characteristics for a material batch. This will include the following steps:

  1. Creation of a function module to check characteristics value (optional)
  2. Creation of a function module to suggest characteristics value – search help (optional)
  3. Creation of new characteristics (CT04)
  4. Creation/modification of a class (CL02)
  5. Object/Class assignment to a class (CL24N or CL20N and OMS2 if necessary)
  6. Batch modification with our new characteristics (MCS2N)

Continue reading

How to maintain text IDs in SAP

SAPIf you want to create new text ID that will be available in SO10 transaction, then follow these easy steps below. Continue reading