Thread: Logic cyclic

  1. #1
    Banned
    Join Date
    Apr 2015
    Posts
    596

    Logic cyclic

    Hi guys; Im asking here about the logic than the code; if I have array with size 15 for instance and have two pointers one pointer pointing on index 0 and the other pointer pointing on index 0; at every step Im increasing the first pointer by 4 jumps ; the other pointer by one jump ...lets assume that they are jumping "infinity time" (always in the pattern I have explained) .. Will they meet each other on specific element in the array in any time?

    My sol: yeah they could meet but they might also not meet ..if there's a constant difference jumps between them


    Thanks alot!!

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    3,687
    The earliest would be a single jump for the one jumping one jump at a time and four jumps on the other.
    Since, this is likely a homework question I will not tell you how.

    Note: I am considering a jump to be a single increment of the pointer.

    Tim S.
    Last edited by stahta01; 05-27-2019 at 12:49 PM.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  3. #3
    Banned
    Join Date
    Apr 2015
    Posts
    596
    Quote Originally Posted by stahta01 View Post
    The earliest would be a single jump for the one jumping one jump at a time and four jumps on the other.
    Since, this is likely a homework question I will not tell you how.

    Note: I am considering a jump to be a single increment of the pointer.

    Tim S.
    didn't understand you explanation, may you illustrate more? thanks alot!

  4. #4
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,859
    Quote Originally Posted by stahta01 View Post
    The earliest would be a single jump for the one jumping one jump at a time and four jumps on the other.
    Since, this is likely a homework question I will not tell you how.

    Note: I am considering a jump to be a single increment of the pointer.

    Tim S.
    You might want to look at RyanC's previous posts

  5. #5
    Registered User
    Join Date
    May 2009
    Posts
    3,687
    I answer his post when it is a valid newbie post instead of just a help vampire spiel.

    His reply is a help vampire reply.

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    37,531
    Well if nothing else, RyanC is famous for going round in circles, never knowing where he's been, or where he's going.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Cyclic number question
    By akdx90 in forum C++ Programming
    Replies: 1
    Last Post: 04-17-2017, 06:15 AM
  2. Cyclic function
    By Laurentiu Dobre in forum C Programming
    Replies: 12
    Last Post: 02-16-2017, 12:18 PM
  3. how to find if array is cyclic
    By SA80 in forum C Programming
    Replies: 3
    Last Post: 05-05-2012, 03:53 AM
  4. cyclic buffer
    By Fortune in forum C Programming
    Replies: 2
    Last Post: 04-23-2009, 05:19 AM
  5. Need a little help with Cyclic Numbers Program
    By SlyMaelstrom in forum C++ Programming
    Replies: 3
    Last Post: 10-19-2005, 05:01 PM

Tags for this Thread