# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

from dsalgo.linked_list import LinkedList

ls = LinkedList()

ls.append(5)
ls.append(4)
ls.append(3)

# ls

# + tags=[]
ls.print()
# -

ls.to_list()

rls = ls.reverse()

rls.to_list()

rls.head

rls.head.value

rls.insert(5,7)

# + tags=[]
rls.print()
# -

ls.to_linked_list([4,5,6])

# + tags=[]
ls.print()
# -

ls.to_linked_list([4,5,6,7])

# + tags=[]
ls.print()
# -

sorted_ls = ls.sort()

ls.swap_nodes(1,2)

# + tags=[]
ls.print()
# -

ls.pop()

# + tags=[]
ls.print()
# -

nls = ls.sort()

# + tags=[]
nls.print()
# -

nls.to_linked_list([4,5,6,7,8])

nls.skip_i_delete_j(1,3)

# + tags=[]
nls.print()

StarcoderdataJupyterScriptsDedupFiltered