A
A
afna2015-02-10 15:37:15
Java
afna, 2015-02-10 15:37:15

Checking for looping in a singly linked list?

Tell me, please, where can I read intelligibly to a beginner on the algorithm for checking looping in a singly linked list?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sumor, 2015-02-10
@sulik93

en.wikipedia.org/wiki/Cycle_detection

I
Ilya Gerasimov, 2017-09-30
@FitTech

var arr = [100, 1000, 10000, 30000];
var res = [];
arr.forEach((value, key) => {
  res.push((key
      ? (arr[key-1] + " - " + value)
      : ("< " + value)));

  if (key === (arr.length-1))
    res.push("> " + value);
});

console.log(res);

59cfcd74f123d976728593.jpeg

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question