سایت ساز وبزیکسب درآمد

circular linklist output

شروع موضوع توسط srad ‏23 مارس 2007 در انجمن خانواده C++ , C

  1. srad

    srad کاربر تازه وارد

    تاریخ عضویت:
    ‏8 مارس 2007
    نوشته ها:
    2
    تشکر شده:
    0
    here is a code about a circularlinklist,which its nodes contain a number between 1 to 2048(first node contains 1 and the lastnode contains 2048) and pointer P that refers to the last node...what does this code do?
    while(p->next!=p){
    p->next=p->next->next;
    p=p->next;
    }
    cout<< p->info;​
     
  2. بازدیدیار - افزایش بازدید سایت و سیگنال های برندخرید بک لینک
  3. Arash_j13

    Arash_j13 Registered User

    تاریخ عضویت:
    ‏18 فوریه 2005
    نوشته ها:
    778
    تشکر شده:
    2
    محل سکونت:
    مشهد
    Josephus problem
    The Josephus problem (or Josephus permutation) is a theoretical problem occurring in computer science and mathematics.

    There are n people standing in a circle waiting to be executed. After the first man is executed, k − 1 people are skipped and the k-th man is executed. Then again, k − 1 people are skipped and the k-th man is executed. The elimination proceeds around the circle (which is becoming smaller and smaller as the executed people are removed), until only the last man remains, who is given freedom.

    The task is to choose the place in the initial circle so that you survive (are the last one remaining), given n and k.

    History
    The problem is named after Flavius Josephus, a Jewish historian living in the 1st century. As the legend goes, he and his 40 comrade soldiers were trapped in a cave, surrounded by Romans. They chose suicide over capture and decided that they will form a circle and start killing themselves using a step of three. As Josephus did not want to die, he was able to find the safe place, and stayed alive with his comrade, later joining the Romans who captured them.

    For more information visit Josephus problem.

     
عسل طبیعی و گرده گل ایرانیخرید و فروش اتوماتیک ارزهای الکترونیکی