LATEST POSTS - page 2


LABOUCHERE SYSTEM C PROGRAM

Here is the full C code for the Doubly Linked List: Labouchere System.

Read More
Posted on by Vikas N. Kumar.

x86-64 TUTORIAL: DOUBLY LINKED LIST

THE LABOUCHERE SYSTEM

The Labouchere system for roulette is played as follows. Write down a list of numbers, usually 1, 2, 3, 4. Bet the sum of the first and last, i.e. 1 + 4 = 5, on red. If you win, delete the first and last numbers from the list. If you lose, add the amount that you last bet to the end of the list. Then use the new list and bet the sum of the first and last numbers (if there is only one number, bet that amount). Continue until your list becomes empty. You will see that, if this happens, you will always win the sum 1 + 2 + 3 + 4 = 10, of the original list. The below program simulates this system. Execute the program, and see if you always win!

Read More
Posted on by Vikas N. Kumar.

x86-64 TUTORIAL: FACTORIAL WITH RECURSION

The calculation of a factorial of a number can be done using recursion. Below is the algorithm:

Read More
Posted on by Vikas N. Kumar.

x86-64 TUTORIAL: CONDITIONAL OPERATIONS WITHOUT BRANCHING

The regular JMP and conditional Jcc jump instructions change the course of working code, the latter based on the runtime status of certain bits in the RFLAGS register. The x86 and x86-64 processors implement pipelining of instructions where they prefetch a certain number of instructions and evaluate them before time. The number of instructions prefetched is dependent on the prefetch input queue (PIQ).

Read More
Posted on by Vikas N. Kumar.

x86-64 TUTORIAL: BIT SHIFTING OPERATIONS

Logical shifts are operations in which the bits of a register or memory location are moved to the right or left by a certain number or a value in the CL register. They are also a very quick way to multiply or divide by 2 or powers of 2 as it involves just a shift of bits. There are 4 shift bit instructions, 4 rotate bit instructions and 2 double precision shift bit instructions for general purpose registers.

Read More
Posted on by Vikas N. Kumar.

Pages: Newer  |  1  |  2  |  3  |  4  |  Older