This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LinkedListNode: | |
def __init__(self, value = None, next_node = None): | |
# stores the data for the current node | |
self.value = value | |
# stores a reference to the next node in the linked list | |
self.next_node = next_node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def reverse_linked_list_recursive(head): | |
if head is None: # handles empty linked list | |
return head |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def reverse_linked_list_recursive(head): | |
if head is None: # handles empty linked list | |
return head | |
if head.next_node is None: # handles linked list with one node | |
return head |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def reverse_linked_list_recursive(head): | |
if head is None or head.next_node is None: | |
return head |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def reverse_linked_list_recursive(head): | |
if head is None: # handles empty linked list | |
return head | |
if head.next_node is None: # handles linked list with one node | |
return head | |
# A. label the end node as the new head node | |
new_head = head.next_node | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def reverse_linked_list_recursive(head): | |
if head is None: # handles empty linked list | |
return head | |
if head.next_node is None: # handles linked list with one node | |
return head | |
# A. label the end node as the new head node | |
new_head = reverse_linked_list_recursive(head.next_node) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## === Backup Environment | |
# 1. Backup your settings.json file | |
# | |
# For total control over extension versions, | |
# - extensions.autoUpdate | |
# - extensions.autoCheckUpdates | |
# | |
# Default settings.json locations: | |
# - Windows: %APPDATA%\Code\User\settings.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function TrieNode(char, terminal = false) { | |
this.char = char; | |
this.terminal = terminal; | |
this.nextChars = {}; | |
} | |
function Trie() { | |
this.root = new TrieNode(null); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class bst_node: | |
def __init__(self, val, left=None, right=None): | |
self.val = val | |
self.left = left | |
self.right = right | |
# assumes arr is sorted | |
def bst_from_array(arr): | |
if len(arr) == 0: | |
return None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted | |
if (-not (Get-InstalledModule -Name posh-git)) | |
{ | |
Install-Module posh-git -Scope CurrentUser | |
} | |
if (-not (Get-InstalledModule -Name oh-my-posh)) | |
{ | |
Install-Module oh-my-posh -Scope CurrentUser | |
} |