Neetcode - Linked List [Algorithms & Data Structures for Beginners]

하은·2024년 6월 20일

Neetcode

목록 보기
2/2

1. Singly Linked Lists

Linkes Lists: An another data structure that is like an array in the sense that it stores elements in an ordered sequences, but there are also differences

  1. The differnece is that linked lists are made up of objects called ListNode.
  • Value) This stores the value of the node, the value can be anything - a character, and integer, etc
  • Next) This stores the reference to the next node in the linked list
  1. Creating A Linked List From Scratch
  • Chaining these ListNode objects together is what results in a linked list.
class ListNode:
	def __init__(self, val):
    	self.val = val
        self.next = None
profile
ONE BY ONE, STEP BY STEP

0개의 댓글