Your concept feed

17 ideas

A few small steps. No rush.

Follow the connections in this topic

Let’s picture it

Each node knows only the next node.

A:3
B:5
C:8

A holds 3 and points to B. B holds 5 and points to C. There is no index jump to C.

Swipe when you’re ready
One little change

Keep the entrance.

head → A
A → B
B → C

The head reference is how we reach the chain. Losing it can make the remaining nodes unreachable.

Same idea. One more small step.
Now it has a name

Pointer updates change topology.

save next
rewire
advance

Changing one next reference can detach, join, or cycle a chain. Save any reference needed after the change.

Want to try a tiny question?
No pressure. Just try it.

Can a singly linked list read its kth item in O(1)?

You can also keep scrolling
1 / 4
Linked lists

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Draw our little walk.

Home
Park
Café

A dot for each place. A line where we can walk directly.

1 / 3
Let’s picture it

Reversing one arrow loses the road ahead.

A
B
C

At A→B→C, changing A.next to None before saving B would lose access to B and C.

Swipe when you’re ready
One little change

Use three named hands.

previous
current
saved next

Previous is the reversed prefix, current is the node to move, and saved next preserves the untouched suffix.

Same idea. One more small step.
Now it has a name

Move one node across the boundary.

reversed prefix
untouched suffix

Save current.next, point current backward, then advance previous and current. The unfinished suffix remains reachable.

Want to try a tiny question?
No pressure. Just try it.

Which reference must be saved before changing current.next?

You can also keep scrolling
1 / 4
Linked lists

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Each node knows only the next node.

A:3
B:5
C:8

A holds 3 and points to B. B holds 5 and points to C. There is no index jump to C.

1 / 3
Let’s picture it

Two walkers use different speeds.

slow +1
fast +2

Slow moves one edge; fast moves two. On an acyclic chain, fast reaches the end first.

Swipe when you’re ready
One little change

Inside a cycle, the gap wraps around.

cycle
gap shrinks modulo length

Fast gains one step per round relative to slow, so their positions must eventually meet.

Same idea. One more small step.
Now it has a name

Meeting is not the entrance yet.

head walker
meeting walker
same speed

Reset one walker to head. Move both one step; their next meeting is the cycle entrance.

Want to try a tiny question?
No pressure. Just try it.

Does the first slow-fast meeting always equal the cycle entrance?

You can also keep scrolling
1 / 4
Linked lists

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Each node knows only the next node.

A:3
B:5
C:8

A holds 3 and points to B. B holds 5 and points to C. There is no index jump to C.

1 / 3
Let’s picture it

Only two front nodes can be next.

1→4
2→3

For 1→4 and 2→3, every later node is at least its list’s front. Compare 1 and 2.

Swipe when you’re ready
One little change

Attach the smaller front.

answer→1
4
2→3

Append 1 and advance only that list. The same promise remains for 4 and 2.

Same idea. One more small step.
Now it has a name

A dummy head removes a special case.

dummy
merged chain

Build after a sentinel, then return sentinel.next. When one list ends, attach the other suffix.

Want to try a tiny question?
No pressure. Just try it.

Must we allocate new nodes to merge?

You can also keep scrolling
1 / 4
Linked lists

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Each node knows only the next node.

A:3
B:5
C:8

A holds 3 and points to B. B holds 5 and points to C. There is no index jump to C.

1 / 3
Let’s picture it

Interleave ends without random access.

1
2
3
4

Turn 1→2→3→4 into 1→4→2→3. A singly linked list cannot jump to the tail repeatedly.

Swipe when you’re ready
One little change

Find and reverse the second half.

1→2
4→3

Slow-fast pointers find the middle. Reverse 3→4 into 4→3 so both needed fronts are accessible.

Same idea. One more small step.
Now it has a name

Weave the two chains.

1
4
2
3

Alternately attach one node from each half, saving both next references before rewiring.

Want to try a tiny question?
No pressure. Just try it.

Which earlier patterns combine here?

You can also keep scrolling
1 / 4
Linked lists

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Reversing one arrow loses the road ahead.

A
B
C

At A→B→C, changing A.next to None before saving B would lose access to B and C.

1 / 3
Let’s picture it

Each node has two kinds of links.

next →
random ↝

A next link forms the chain. A random link may point anywhere inside it or to None.

Swipe when you’re ready
One little change

Copies need identity mapping.

original A↝C
copy A↝copy C

If original A.random points to original C, copy A.random must point to copy C—not the original.

Same idea. One more small step.
Now it has a name

Create first, connect second.

old → copy map
translate links

First map every original node to its copy. Then translate both next and random links through that map.

Want to try a tiny question?
No pressure. Just try it.

Why is copying only node values insufficient?

You can also keep scrolling
1 / 4
Linked lists

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Each node knows only the next node.

A:3
B:5
C:8

A holds 3 and points to B. B holds 5 and points to C. There is no index jump to C.

1 / 3
You've reached the end of these ideas.Try them without the labels